NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft...

278
NSOFT NSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language January 2001

Transcript of NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft...

Page 1: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

NSOFTNSOFT

Ansoft High Frequency StructureSimulator

Introduction to the AnsoftMacro Language

January 2001

Page 2: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

ii

NoticeThe information contained in this document is subject to change withoutnotice.Ansoft makes no warranty of any kind with regard to this material, including,but not limited to, the implied warranties of merchantability and fitness for aparticular purpose. Ansoft shall not be liable for errors contained herein or forincidental or consequential damages in connection with the furnishing, per-formance, or use of this material.This document contains proprietary information which is protected by copy-right. All rights are reserved.

Ansoft CorporationFour Station SquareSuite 200Pittsburgh, PA 15219(412) 261 - 3200

Motif is a trademark of the Open Software Foundation, Inc.UNIX is a registered trademark of UNIX Systems Laboratories, Inc.Windows is a trademark of Microsoft® CorporationOpenWindows is a trademark of Sun Microsystems, Inc.

© Copyright 1994 - 2001 Ansoft Corporation

Page 3: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

iii

Printing HistoryNew editions of this manual will incorporate all material updated since theprevious edition. The manual printing date, which indicates the manual’scurrent edition, changes when a new edition is printed. Minor corrections andupdates which are incorporated at reprint do not cause the date to change.Update packages may be issued between editions and contain additionaland/or replacement pages to be merged into the manual by the user. Notethat pages which are rearranged due to changes on a previous page are notconsidered to be revised.

Welcome!This manual is a user’s reference for using the Ansoft Macro Language fromAnsoft HFSS, including the Ansoft Macro Editor.

Installation GuideBefore you use Ansoft HFSS, you must:1. Set up your system’s graphical windowing system.2. Install the Maxwell software, using the directions in the installation

guide.

If you have not yet done these steps, refer to the installation guides and thedocumentation that came with your computer system, or ask your systemadministrator for help.

Other ReferencesFor detailed information on the Ansoft HFSS commands, refer to the onlinehelp provided with Ansoft HFSS.For detailed information on the Control Panel commands, refer to the onlinehelp for the Maxwell Control Panel.

Edition Date Software Revision

1 November 1998 6.0

2 November 1999 7.0

3 January 2001 8.0

Page 4: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

iv

Typeface ConventionsComputer Computer type is used for on-screen prompts and

messages, for field names, and for keyboard entriesthat must be typed in their entirety exactly as shown.For example, the instruction “copy file1” means to typethe word copy, to type a space, and then to type file1.

Menu/Command Computer type is also used to display the commandsthat are needed to perform a specific task. Menu levelsare separated by forward slashes (/). For example, theinstruction “Choose File/Open” means to choose theOpen command under the File menu.

Italics Italic type is used for emphasis and for the titles ofmanuals and other publications. Italic type is also usedfor keyboard entries when a name or a variable mustbe typed in place of the words in italics. For example,the instruction “copy filename” means to type the wordcopy, to type a space, and then to type the name of afile, such as file1.

Keys Helvetica type is used for labeled keys on the com-puter keyboard. For example, the instruction “PressReturn” means to press the key on the keyboard thatis labeled Return.

Page 5: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Introduction 1-1

1

Introduction

Macros are fast, effective ways to accomplish tasks you wish to repeat or tocreate your own interface panels to perform specific tasks. A macro is builtfrom Ansoft-specific script commands, much like the scripting capabilities ofUNIX workstations. When you execute a macro from Ansoft HFSS, the soft-ware executes the script commands. With macros you can:● Quickly perform repetitive actions.● Create and solve projects whose properties vary, such as the dimensions

of the model or the values of boundaries and sources. Macros can bedesigned to prompt you for the necessary information when they need it.

● Export values and results to a database file.● Create your own interface to prompt a user for information to use in

performing a specific task.

☞Note: In the Maxwell 3D Modeler, a macro is automatically created from your

entered steps, saving you the effort of creating a new one. This macro canbe edited at will, using the Ansoft Macro Editor.

This feature does not exist in any other module.

Page 6: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macros

1-2 Introduction

MacrosMacros are built from both script commands and script control commands. Inmost cases, the starting point for building a macro is using the interface torecord the initial commands. Once you have recorded the script commands toa macro, you can edit the macro with any text editor.The macro language in Ansoft HFSS can be, like most programming lan-guages, complex and it requires strict adherence to syntax. If you have experi-ence programming, editing a macro and the idiosyncrasies of the macrolanguage will be similar to other programming languages. If the Ansoft HFSSmacro language represents your first experience with programming, a hand-book for beginning programmers may be useful in understanding the macrolanguage.

Recording a MacroOnce you start to record a macro, your subsequent actions are added to themacro. Each interface command has one or more associated script commandsthat are recorded to the macro.

➤ To create a macro from the command prompt:1. Choose View/Command Prompt. The command prompt window appears

below the project window.

2. In the command prompt area, type:FileRecord “Filename.mac”

where Filename.mac is the name of the macro you wish to create. Fromthis point forward, every step will be recorded into the macro.

3. Step through that part of the project you wish to record. You can do thiswith the mouse or by entering the commands into the command prompt.

4. When you have finished creating the macro, type FileRecStop or chooseCtrl+F2. The macro is now finished and the steps have been saved to thetext file Filename.mac.

➤ To create a macro using a hotkey or menu command:1. Choose File/Macro/Start Recording or press Ctrl+F1. A window appears

prompting you for the name of the macro to record.2. Enter the name of the new macro. The software automatically adds the

.mac extension.3. Choose OK. From this point forward, every step will be recorded.

☞Note: You may also use the hotkey Ctrl+F4 to access the command prompt.

Page 7: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macros

Introduction 1-3

Executing a MacroYou can execute the macro in any project.

➤ To execute a macro, do one of the following:● To execute a macro from the command line, do one of the following:

■ If you want to execute the macro and remain in Ansoft HFSS, enterthe following from the directory containing the project:

hfss -macexec macro_name project.pjt

Ansoft HFSS starts and immediately executes the macro. Once themacro has finished, Ansoft HFSS remains open, allowing you to per-form other tasks.

■ If you want to execute the macro and exit Ansoft HFSS after it is fin-ished, enter the following from the directory containing the project:

hfss -macandexit macro_name project.pjt

Ansoft HFSS starts and immediately executes the macro. Once themacro has finished, Ansoft HFSS exits.

● To execute a macro using a hotkey or menu command:a. Choose File/Macro/Execute or press Ctrl+F3. A file browser appears,

allowing you to choose the macro you want to execute.b. Enter the name of the macro to execute in the field provided.c. Choose OK.

● To execute a macro using the command prompt:a. Choose View/Command Prompt from the menu bar. The command

prompt area appears below the project window.b. In the command prompt area, type FileExec “Filename.mac”, where

Filename.mac is the name of the macro you wish to execute.

Setting the Macro’s PathYou may set the path the software automatically searches for macros by add-ing the following line to the .maxwellrc or maxwell.ini file:

MacroPath path

☞Note: If you use the SolveSetup when you use macandexit, be certain that you

make the Solution Setup window visible. Refer to “SolveSetup” on page5-4 for more information about this command.

Page 8: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Script Commands

1-4 Introduction

Script CommandsScript commands are the basic components of macros. You can enter thesecommands at the command prompt window, or play them back from a macrofile. The commands are automatically issued as you use the software.

Command SetsScript commands are organized into command sets. A command set is simplya grouping of related script commands. Different command sets are useddepending on the Ansoft HFSS module currently in use. The following com-mand sets are available in Ansoft HFSS:

Default The Default command set is unlike the others in that itsscript commands form the basis for the other script com-mands. Most script commands from the Default com-mand set cannot be recorded using the interface. Thiscommand set also includes wizard capability. It is avail-able in every module.

Generic Module The Generic Module command set contains generic scriptcommands. This command set is available in every mod-ule.

Mod3proj The Mod3proj command set contains script commandsthat manipulate Ansoft HFSS projects. Some of the scriptcommands from this command set, like the Default com-mand set, can not be recorded to a macro. This commandset is available in every module that displays the geomet-ric model.

Mod3view The Mod3view command set contains script commandsthat manipulate the view of the projects. This commandset is available in every module that displays the geomet-ric model.

Modeler3 The Modeler3 command set contains script commandsspecific to the 3D Modeler.

MaterialsKernel The MaterialsKernel command set contains script com-mands specific to the Material Manager.

Boundary Module The Boundary Module command set contains script com-mands specific to the 3D Boundary Manager.

Boundary Kernel The Boundary Kernel command set also contains scriptcommands specific to the 3D Boundary Manager.

Mesh3D The Meshmaker module command set contains com-mands specific to the 3D Meshmaker.

Page 9: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Script Commands

Introduction 1-5

Entering a Script Command from the Command PromptTo enter script commands individually, rather than from a macro, use thecommand prompt available in the current module. The following modeldrawing command creates a 20x40x20 box named openbox whose base vertexis at the origin.

➤ To enter a script command:1. Choose View/Command Prompt. The command prompt area appears at

the bottom of the window.2. Enter the script command into the command prompt. You may enter

more than one script command with any associated arguments. Forexample, to create a box, use the box script command and its argumentsof base vertex, size in the x-, y-, and z-direction, and the name of the boxyou want to create. To create a box whose base vertex was at the origin,

Post3D The Post3D command set contains script commands spe-cific to the 3D Post Processor.

Plot3D The Plot3D command set contains script commands spe-cific to the 3D Post Processor plotting functions.

FieldCalculator The FieldCalculator command set contains script com-mands specific to 3D Post Processor Field Calculator.

MatrixData The MatrixData command set contains script commandsspecific to the Matrix Data Post Processor.

MatrixPlot The MatrixPlot command set contains script commandsspecific to the Matrix Plot Post Processor.

HFSS The HFSS command set contains script commands spe-cific to Ansoft HFSS.

Emissions Setup The Emissions Setup command set contains script com-mands specific to Emissions Setup.

Solve Setup The Solve Setup command set contains script commandsspecific to Solve Setup.

➥Warning: When you click in the window of a module, only the command sets for that

module are available. If a macro is currently running one module, selectinga second module may cause errors when the system tries to access thescript commands from the first module.

For example, if you are running a macro which is defining boundaries inthe 3D Boundary Manager, do not activate the Executive Commands win-dow. The commands in the Executive module will be activated, and whenthe macro tries to execute a script command from the 3D Boundary Man-ager, it will fail.

Page 10: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Script Commands

1-6 Introduction

you would enter:box [0,0,0] 20 40 20 “openbox”

3. Choose Enter to enter the command.➤ To see a list of script commands:

● Type help commands in the command prompt area. A list of all availablecommands appears. Beside each command is a brief explanation.

➤ To see a description of a specific command:● Type help commandname in the command prompt area. A description of

the command, and its required parameters, is listed.

Script Command LayoutThe majority of this guide deals with individual script commands. The fol-lowing layout is used in describing them:

☞Note: Many of the script commands are associated with interface commands. For

detailed information on the what the command does, refer to the interfacecommand’s online help.

Script command name

Use: Describes the function of the script command.Command: Lists the associated interface commands. If there are too many

or none at all, “none” will be listed.Syntax: demonstrates the proper syntax for the

command. the syntax used for the switches oroptions indicates what type of informationneeds to be entered for that option.

Note: Explains any switches or options used in the syntax.Example: Provides a working example of the script command.

The results are explained below the example.

Page 11: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Script Commands

Introduction 1-7

Syntax Conventions

Script commands are often followed with arguments that further define theirfunctions. These arguments fall into one of the following eight categories:

Script command names are case insensitive, but script arguments are not.This is most important when you are comparing strings in a macro.If a script command does not fit on a line, you can continue the command byappending a backslash (\) to the end of the first line. For example, the expres-sion:

numer = (y01*d122) + (y12*d012)

would be written in the following way:Assign numer (Add (Mul (Mul d12 d12) y01) \(Mul (Mul d01 d01) y12))

with the backslash continuing the expression on the next line.

LONG An integer. Integer numbers require no brackets whenentering these values in a script command.

DOUBLE A double precision floating point number. Again, noquotes are required for these values.

“string” A string is a character sequence that must be enclosedin quotation marks. File names, object names, andexpressions are always entered with quotation marks(single or double).

<vectors> Vectors are always entered with carat brackets. Thecomponents in the brackets must be separated withcommas.

[positions] Positions are always entered with square brackets. Thecomponents in the brackets must be separated withcommas.

{“string list”}{DOUBLE list}

Braces are used to enclose a series of strings or doublesin the script commands. A string list will resemble{“String1” “String2” “String3”}. No commas separatethe strings.

Page 12: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Script Control Commands

1-8 Introduction

Script Control CommandsAnsoft HFSS provides control commands that are not generated when youuse the interface in FileRecord mode. These commands control the macro exe-cution by letting you set variable values, test variable and expression values,conditionally execute portions of the macro, and use loop control within yourmacro.

Command ConstructsThe following constructs are available in Ansoft HFSS.

IF

IF is used to create a conditional argument. If a condition is true, the contentsof the IF statement are executed. Otherwise, the IF statement is skipped(unless you have an ELSE condition in the IF statement). There are two typesof IF statements you can create. The first type uses conditionals and executesonly if the condition is true. For example:

Assign test 5IF EQ test2 test

Assign test2 6END

This IF statement executes as long as the value of the variable test is equal tothe value of the variable test2.The second type does not use conditionals; instead, it depends on the exist-ence of something. For example:

IF testAssign test2 6

END

This IF statement executes as long as a variable called test exists and has anon-zero value.You may also use an ELSE statement in an IF statement. For example:

Assign test 5

IF EQ test2 testAssign test2 6

ELSEAssign test2 4

END

In this example, if test2 = 5, it becomes 6; otherwise, it becomes 4.Unlike the REPEAT and WHILE statements, an IF statement is only executedonce before continuing with the macro.

Page 13: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Script Control Commands

Introduction 1-9

REPEAT

REPEAT is used to execute the contents of the REPEAT loop the number oftimes specified. For example:

Repeat 4echo “This is a test”

End

This statement repeats the line This is a test four times. You may also usevariables or commands that return integers, such as GetNumObjects, to spec-ify the number of times to repeat the loop.

WHILE

WHILE is used to create an action while a condition is true. The conditionshould be able to be false at some point in the WHILE statement. WHILEchecks the state of the condition at the beginning of the loop; if the conditionchanges to false within the loop, the pass through the loop is completedbefore it is exited.

Like an IF statement, there are two types of WHILE statements you can cre-ate. The first type uses conditionals and executes only while the condition istrue. For example:

ASSIGN count 5WHILE EQ count 5

ASSIGN count SUB count 1ECHO “count is “ count

END

This statement only executes while count is equal to 5.The second type does not use conditionals; instead, it executes while the vari-able remains non-zero. For example:

ASSIGN count 5WHILE count

ASSIGN count SUB count 1ECHO “count is “ count

END

Executing these commands will display Count is 4, Count is 3, and so forthuntil the decreasing value reaches zero. It stops at zero because the WHILEcondition becomes false. You could also have used a negative number andincreased the value until it reached zero.

➥Warning: Because a WHILE statement can create an infinite loop, make sure the

means of ending the WHILE statement are present in the statement itself.Otherwise it will continue to execute without stopping.

If you accidentally create an infinite loop, press Esc to terminate the macro.

Page 14: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Script Control Commands

1-10 Introduction

Mathematical Expressions and ConditionsThe following mathematical expressions and conditions can be used in macrolanguage.

Conditionals

IF and WHILE statements frequently use conditional arguments as part oftheir syntax. The following mathematical conditionals are available:

The proper syntax for conditionals is to place the expression before the argu-ment, as in:

EQ Y 5

which means test for y being equal to 5.In addition to the mathematical conditionals, there are three boolean condi-tionals you can use.AND

AND evaluates the values of two variables or conditions. If neither is zero, avalue of 1 is returned to the macro. If one of the values is zero, a value of 0 isreturned to the macro. For example:

Assign temp1 (AND variable1 variable2)IF EQ temp1 1

Assign width 4End

Thus, a width of 4 is assigned to temp1 only when variable1 = variable2. Thevariable temp1 can then be used in other constructions, such as the IF state-ment used in this example.OR

Like AND, OR evaluates the values of two variables or conditions. If either isnon-zero, a value of 1 is returned to the macro. If both are equal to zero, avalue of 0 is returned to the macro.

Conditional Function

EQ Equal to

NE Not equal to

GT Greater than

LT Less than

GE Greater than or equal to

LE Less than or equal to

Page 15: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Script Control Commands

Introduction 1-11

XOR

For XOR, if one of the values or conditions is equal to zero and the other isnonzero, a value of 1 is returned to the macro. If both are equal to zero or non-zero, a value of 0 is returned to the macro.

Expressions

Often you need to mathematically manipulate variables in a macro. AnsoftHFSS provides the following mathematical expressions:

The proper syntax for these expressions is:add varname 1

which means varname + 1.You may also group arguments together using parentheses, for example:

add varname (mul 0.5 X)

which means varname + 0.5X.

Expression Function

add Adds two arguments together.

sub Subtracts two arguments.

mul Multiplies two arguments.

div Divides the first argument by the second.

minus Reverses the sign of an argument.

☞Note: Arithmetic operations are done with floating point logic.

Page 16: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Editor

1-12 Introduction

Macro EditorThe Ansoft Macro Editor allows you to create and edit macros, and will putcommand parameters in the correct syntax.When you choose File/Macro/Edit Macro from the File menu of whatevermodule you are in, the following window appears:

Defining Macros in the Macro Editor➤ To create or edit a macro:

1. Choose File/Macro/Edit Macro to access the Ansoft Macro Editor.2. Choose File/New or File/Open to create or edit a macro file. Macro files

have a .mac file extension.When you create a new file, the Macro Editor automatically entersparameter assignment mode and displays the Create New Macro Filewindow. This is the window in which the macro is written. You can alsoenter this mode using View/Assign Parameter Mode , which allows youto review macros and define any parameters.

3. Do any of the following:■ Choose Edit/All Parameters to specify the parameters of the macro.■ Choose View/Edit Mode to enter edit mode and enter new text for

the macro file.■ Place the cursor on the macro statement for which to specify the

parameters and choose Edit/Command Parameters to specify the

Page 17: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Editor

Introduction 1-13

parameters for the selected item. If you select a line with a statementthat has no parameterized values, this command does nothing.

■ Choose Edit/Add Database Export Macro to generate macro codethat creates a database and writes it to a disk file.

4. Choose File/Save to save the macroThe macro is now defined.

Tool BarUse the tool bar in the Macro Editor as a shortcut to executing commands:

● To execute a command, click on the appropriate button.● To display a brief description of the command in the message bar,

move the cursor to the toolbar icon and hold down the mouse button.

Macro Editor CommandsYou can access the following menus from the Macro Editor:

Refer to the online documentation for more information on these commands.

☞Note: If a tool bar icon appears to do nothing when you click on it, the command

may not be available at the time.

File Creates, opens, saves, and closes macros.

Edit Edits and defines command parameters, and adds database exportmacros.

Search Finds and replaces expressions used in the macros.

View Defines the viewing modes, allowing you to assign parameters oredit the macro file. Also displays the parameters of the macro.

Help Accesses the online documentation for the product.

Page 18: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Editor

1-14 Introduction

Page 19: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Examples 2-1

2

Macro Examples

This chapter describes, in detail, two macros: a modeler macro and a start-to-finish optimization macro.

Page 20: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Macro Example — A Magic T

2-2 Macro Examples

3D Modeler Macro Example — A Magic TThe following example demonstrates how a macro can import user-defineddata from a database file to create the device, or prompt the user for thedimensions.

# This macro requires Ansoft HFSS version 6.0 or later# This is a comment line. A # symbol should precede all comments.## The macro requires the following information:## 1) width of the magic T arms# 2) height of the magic T arms# 3) length of the legs of the magic T arms## Use this macro as a base for users for developing your own macros.# Note the syntax used for some commands.## Clear all previously defined variables, functions, and expressions. Do this to# prevent previously defined variables from conflicting with variables you# define in this macro.

ClearAllClearFunctionsExpClear

# Defines the default colors to use in the macro.

DefColor 255 255 0

# The following IF statement tests to see if the Command Prompt window is on or# off. If it is off, it turns it on. If it is on, it leaves it on. This is important in any# macro that prompts the user for input. If the Command Prompt is not visible# and the user is being prompted for input, the system appears to hang while# waiting for input.## Notice the syntax of the IF statement. Not Equal to (NE) precedes both# ModuleIsPromptVisible and 1. This means, “If ModuleIsPromptVisible is not# equal to 1.”

If NE ModuleIsPromptVisible 1ModuleTogglePrompt

End

Page 21: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Macro Example — A Magic T

Macro Examples 2-3

# The following echo block prints out a set of instructions for the user, prompting# the user to select predefined dimensions from a database file or to enter the# dimensions by hand.## All predefined sizes are in inches - taken from Radar Handbook, Skolnik, 1970

Echo " "Echo "This macro will create a Waveguide Magic T"Echo " "Echo "Select the waveguide size:”Echo " WR 650 - Enter 1 WR 137 - Enter 9 "Echo " WR 510 - Enter 2 WR 112 - Enter 10 "Echo " WR 430 - Enter 3 WR 90 - Enter 11 "Echo " WR 340 - Enter 4 WR 75 - Enter 12 "Echo " WR 284 - Enter 5 WR 62 - Enter 13 "Echo " WR 229 - Enter 6 WR 51 - Enter 14 "Echo " WR 187 - Enter 7 WR 42 - Enter 15 "Echo " WR 159 - Enter 8 WR 34 - Enter 16 "

Echo "If you wish to specify the dimensions of thewaveguide by hand, enter 0."

# Now, the macro needs to prompt the user to either select one of the predefined# dimensions or enter the dimensions by hand. This is done by creating a variable# and assigning it the user’s response.

Assign WGSize GetLong "Enter WG size: "

# The prompt changes to state “Enter WG size:” The user may enter one of the# predefined sizes or elect to specify their own by entering zero. Now that the# user’s response has been saved to the variable WGSize, the following two IF# statements control how the macro proceeds.

# For this first IF statement, if the variable WGSize is not equal to zero (which# indicates that the user selected a predefined size), then the database file needs to# be loaded and the correct size extracted from it.

If NE WGSize 0

# Since you are loading sizes from a database file, you need to specify the location# and name of the file for the macro. Assign this file an identification tag in the# same way you would a variable. Later, you can reference the file by the# identification tag.

# The following prompts the user for the path and name of the database file.

Assign FileID ImportDatabase GetString "Enter thepath and file name of the database file:"

Page 22: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Macro Example — A Magic T

2-4 Macro Examples

# If you were going to use more than one database file, you can reference the path# of each file using a variable, then when you import the database, you would# specify the file name. This allows you to store the path of your input and output# files once, removing the need to type in the path of the files each time you want# to import or export a file. For an example, refer to the following commented# lines:## Assign Path GetString “Enter the path of your database files:”# Assign FileID ImportDatabase StrConCat Path GetString “Enter the name of the# first database file: “# Assign FileID2 ImportDatabase StrConCat Path GetString “Enter the name of the# second database file: “## To extract the size from the database file, use the input the user entered above to# select the proper row. However, since the row and column numbering begins at# zero, the user input (WGSize) must be reduced by one to give the proper row# count. Do this by creating another variable that is equal to WGSize minus 1.

Assign DBPointer Sub WGSize 1

# Now, extract the width and height of the waveguide from the database file. The# length will be calculated from the height.

Assign TWidth DatabaseGetField FileID DBPointer 1Assign THeight DatabaseGetField FileID DBPointer 2

# The length is twice the width.

Assign TLength Mul TWidth 2

# Since the units of the dimensions stored in the database file are in inches, you# may need to convert to the current 3D Modeler units. The following IF statement# tests to see if the current units are in inches (by seeing if the unit conversion# factor to meters is equal to that of inches).

If NE GetUnitConv 39.37007874Echo “Macro converting from inches to”GetUnitName

Page 23: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Macro Example — A Magic T

Macro Examples 2-5

# For each dimension of the waveguide, convert it from inches to meters and then,# since the GetUnitConv command gives you the conversion factor from meters to# the current units, convert from meters to the current units. Once the conversion# is finished, reassign the dimension the new value.

Assign TempW Mul TWidth 0.0254Assign TempW2 Mul TempW GetUnitConvAssign TWidth TempW2

Assign TempH Mul THeight 0.0254Assign TempH2 Mul TempH GetUnitConvAssign THeight TempH2

Assign TempL Mul TLength 0.0254Assign TempL2 Mul TempL GetUnitConvAssign TLength TempL2

End

End

# For the second IF statement, if the variable WGSize is equal to zero, then the user# needs to be prompted to enter the size of the waveguide.

If EQ WGSize 0

# Use a WHILE loop to prevent users from entering negative dimensions. To do# this, create a variable and assign it a value such that, as long as the variable has# that value, the WHILE loop will keep repeating.

Assign LookAtWidth -1

# Now, create the WHILE loop and prompt the user to enter the width of the# waveguide. Two IF statements evaluate the value assigned to the width. If the# width is non-negative, a new value is assigned to the WHILE loop variable# LookAtWidth. The WHILE loop compares the new value with the original value# and stops when they are no longer the same. If the width is negative or zero, the# Echo message appears and the WHILE loop continues.# The same WHILE loop is used for each dimension.

While LookAtWidthAssign TWidth GetDouble "Enter waveguide width:"If GT TWidth 0

Assign LookAtWidth 0EndIf LE TWidth 0

Echo "Please enter a width greater than zero."End

End

Page 24: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Macro Example — A Magic T

2-6 Macro Examples

Assign LookAtHeight -1

While LookAtHeightAssign THeight GetDouble "Enter waveguide height: "If GT THeight 0

Assign LookAtHeight 0EndIf LE THeight 0

Echo “Enter a height greater than zero."End

End

Assign LookAtLength -1

While LookAtLengthAssign TLength GetDouble "Length of magic T arms: "If GT TLength 0

Assign LookAtLength 0EndIf LE TLength 0

Echo "Enter a length greater than zero."End

EndEnd

# The following lines are not necessary to complete the macro; however, they place# the waveguide at the origin. By knowing where the center of the object is# regardless of the dimensions, you can move it to any location you want.## Divide each dimension by two and multiply the results by negative one. This# creates a point in a negative quadrant of the coordinate system. When the macro# creates the waveguide from this point, the center of the waveguide will be at the# origin.

Assign TW2 Div TWidth 2Assign MTW2 Mul TW2 -1

Assign TH2 Div THeight 2Assign MTH2 Mul TH2 -1

Assign TL2 Div TLength 2Assign MTL2 Mul TL2 -1

# Up to this point, the macro has been gathering and manipulating data, but has# not used that data to create the waveguide. Now, it will use the information to# draw the waveguide. To do this, it will create three boxes and then unite them to# form a single object, the Magic T.

Page 25: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Macro Example — A Magic T

Macro Examples 2-7

# Before creating any objects, the macro gathers the number of existing objects and# assigns it to a variable. This is used later to prevent naming conflicts between# new and existing objects, or new objects and artifacts of previous objects.

Assign nPrev1 GetNumObjects

# The next three lines draw the three boxes using the Box command. The Box# command draws a box from two points. The user specifies the base vertex point# and the x-, y-, and z- distance of the point opposite the base vertex. Notice that# the Pos3 command is used to specify the base vertex point. This command is# used because variables are being used for the x, y, and z coordinates.## When naming temporary objects, try to select names that are unique. If a macro# tries to create an object with the same name as an existing object, errors may# occur.

Box Pos3 MTL2 MTW2 MTH2 TLength TWidth THeight "base_x111"Box Pos3 MTW2 0 MTH2 TWidth TL2 THeight "base_y111"Box Pos3 MTH2 MTW2 0 THeight TWidth TL2 "base_z111"

# Unite the three objects into a single object. When you unite objects, the resulting# object is given the same name as the first object in the list.

Unite { "base_x111" "base_y111" "base_z111" }

# Once the objects have been united, the user is prompted for the name of the new# object. To avoid potential naming errors, the macro gathers the name of the most# recently created object by adding one to the number of objects variable nPrev1# created earlier. The name of the newest object is assigned to a variable, and the# user-entered name is assigned to another variable. Then, the name saved in the# temporary variable gathered by the system is replaced by the user-entered name.

Assign MagicT1 GetObjectName add nPrev1 1Assign TName GetString "Enter a name for the magic T: "ReName MagicT1 TName;

Echo "The Magic T macro was completed successfully."

# From this point on the macro is removing all the assigned variables, functions,# and expressions, and modifying the display to show the Magic T. You should# always remove any variables after completing a macro to prevent old variables# from interfering with the next macro.

ClearAllClearFunctionsExpClear

# Use a REPEAT loop to step through each of viewing windows and perform a# Fitall on each to show the maximum geometry.

Page 26: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Macro Example — A Magic T

2-8 Macro Examples

# Start by setting the current window pointer to zero. The ID number of the# viewing windows begins at one. Set the current window pointer to zero now# because the macro will be incrementing the current view by one in the REPEAT# loop.

Assign CWindow 0

# Next, execute the REPEAT loop for each viewing window. Do this by assigning# a repeat value equal to the number of viewing windows. Inside the REPEAT# loop the current window pointer is increased by one, activated, then a Fitall is# performed in the current view window.

Repeat GetNumViewsAssign CWindow Add CWindow 1ActivateView CWindowFitAll

End

Page 27: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Macro Example — A Magic T

Macro Examples 2-9

Database File for the Magic TThe database file wgdatabase.dat used in the magic T macro example is shownbelow:

Notice that the column and row numbering begins at zero, and the number ofrows is listed as the first entry in the heading, followed by the number of col-umns. If you are going to use the ImportDatabase command, the first linemust be the number of rows followed by the number of columns. You mayimport a database file without this heading using the ImportRawDatabasecommand. The system calculates the number of rows and columns and storesthem in memory for databases imported using that command.For further information regarding the database commands, refer to Chapter 3,“Default Command Set.”

Columns

0 1 2

17 3

0 650 6.5 3.25

1 510 5.1 2.55

2 430 4.3 2.15

3 340 3.4 1.70

4 284 2.84 1.34

5 229 2.29 1.145

6 187 1.872 0.872

7 159 1.590 0.795

8 137 1.372 0.622

9 112 1.122 0.497

10 90 0.900 0.400

11 75 0.750 0.375

12 62 0.622 0.311

13 51 0.510 0.255

14 42 0.420 0.170

15 34 0.340 0.170

16 650 6.5 3.25

Rows

Numberof rows

Number ofcolumns

Page 28: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

2-10 Macro Examples

Macro Example — An Optimization MacroThe following example demonstrates how a macro can create and solve aproblem many times while varying some of the problem’s parameters. Theresults of the problem are used to calculate the new values for the parameters.When the optimal results are obtained, the macro stops creating and solvingthe problem.This example also demonstrates how multiple macros can be used for oneproblem. A macro file may call a second macro. Once the second macro hasfinished, the first macro picks up where it left off. A macro can call any num-ber of secondary macros (which, in turn, can call macros).These macros create a simple waveguide discontinuity problem. The heightof the rod is varied until the desired value for the S-parameters is obtained.The initial values, as well as the chosen target function |S11| = 0.5, for thisproblem are arbitrarily chosen.

☞Note: An optimization macro like this should be started using the command

prompt, and not from the interface. When you run a start-to-finish macrofrom the interface, a message appears once the solution has finished,requiring the user to choose OK. If you run the macro from the commandprompt, this message does not appear, and the macro can run withoutattention. An example of the syntax used to start this problem is shownbelow:hfss -macexec rod_opti.mac rod.pjt

The macro rod_opti.mac must be in the project directory rod.pjt.

Page 29: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

Macro Examples 2-11

The Initial MacroThis macro defines variables specific to this problem and executes the genericminimizer macro. The minimizer macro uses a formulate objection functionsuch that it has a minimum as the optimum.

# The following variables are model parameters that define the name of the# secondary macro to execute, the name of the database file, the maximum# number of iterations to perform, and the stopping criterion epsilon.## It is generally a good practice to assign the names of macros and databases to a# variable. This allows you to modify a single variable, and the name changes each# place the variable is used.

Assign macro_name "rod_param.mac"Assign db_name "rod_param.db"Assign max_iter 5Assign epsilon 0.01

# The following variables define the initial design parameters for the problem.

Assign x0 1Assign x1 63.1069947613444Assign x2 99

# The following variables define the pre-calculated cost values for the associated# initial design parameters, x0, x1, and x2.

Assign y0 0.246880502637075Assign y1 0.202741507883882Assign y2 0.233540887386906

FileExec “minimizer.mac”

Page 30: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

2-12 Macro Examples

The Minimizer MacroThe minimizer macro is responsible for the following:● Assigning the variables used in most of the problem.● Calculating an improved value for the design variable.● Executing the macro that creates and solves the problem.● Writing the design parameters and cost function value to a database file

for each iteration of the problem.

# This macro uses one dimensional minimization (superlinear convergence).## INPUT VARIABLES# The following variables are either entered by the user, or are calculated# by the macros.## macro_name: Macro for function evaluation (finite element solve).# in: x The design parameter for the new run (double).# out: y The value of objective function (double).## db_name: database name (string)# At each step, the pair (x, y) is written to file.## x0, x1, x2: initial bracket for the parameter x with x0 < x1 < x2# x0 lower bound# x1 intermediate point# x2 upper bound# y0, y1, y2: objective function at x0, x1, x2# It is required that y1 < y0 AND y1 < y2 (bracket condition)## max_iter: max number of iterations to perform before stopping# epsilon: termination criterion. Iteration terminates when:# | x(new) - x(old) | < | epsilon |# OUTPUT VARIABLES# The exit_flag variable is defined by the macro based on the specified# conditions listed below.## exit_flag:# -1 solution not yet reached, continue with macro# 0 termination criterion satisfied, stop# 1 x1 <= x0 initial parameters: invalid order, stop# 2 x1 >= x2 initial parameters: invalid order, stop# 3 y1 >= y0 initial data: not a valid bracket, stop# 4 y1 >= y2 initial data: not a valid bracket, stop# 5 cannot find minimum (3 points on straight line), stop# 6 y1 == ynew cannot find minimum (flat), stop# 7 xnew <= x0 cannot find minimum (out of range), stop# 8 xnew >= x2 cannot find minimum (out of range), stop# 999 exceeded max number of iterations, stop

Page 31: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

Macro Examples 2-13

# The following variables define the initial exit_flag value, the ID of the new# database file, and some values used in the algorithm. Notice that two# script commands are used when defining the database variable, the Assign# command and the NewDatabase command.

Assign exit_flag -1Assign db_id NewDatabase 2Assign zero 1e-10Assign coef 0.38197

# The following four IF statements test the initial x and y parameters. If there is an# error with them, the appropriate exit_flag is assigned and the macro will# terminate.

if LE x1 x0Assign exit_flag 1

end

if GE x1 x2Assign exit_flag 2

end

if GE y1 y0Assign exit_flag 3

end

if GE y1 y2Assign exit_flag 4

end

# The following IF statement prints the initial parameters to the database file.# Notice that, before each parameter pair is printed to the database, the number of# rows is counted and assigned to a variable, and a new row is added.

if EQ exit_flag -1

# Since the new database does not contain any rows initially, you need to add a# row to the database. However, before adding a row, you must gather the# number of rows and assign that number to a variable. Since row numbering# begins at zero, the first row added will be row zero. Thus, adding the row before# gathering the number of rows would result in an error, since you would be# trying to add values to a row that didn’t exist.

Page 32: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

2-14 Macro Examples

# Each time you want to write a new line to the database file, you must add row# numbers. You only need to do this for rows, since the number of columns was# defined when you created the new database file.

Assign rowcnt DatabaseGetRows db_idDatabaseAddRow db_idDatabaseSetField db_id rowcnt 0 x0DatabaseSetField db_id rowcnt 1 y0

Assign rowcnt DatabaseGetRows db_idDatabaseAddRow db_idDatabaseSetField db_id rowcnt 0 x1DatabaseSetField db_id rowcnt 1 y1

Assign rowcnt DatabaseGetRows db_idDatabaseAddRow db_idDatabaseSetField db_id rowcnt 0 x2DatabaseSetField db_id rowcnt 1 y2ExportDatabase db_id db_name "yes"

end

# The following WHILE statement is the main loop of the macro. As long as the# conditional expression is true, the loop will keep executing. For an optimization# macro such as this, you must use a WHILE statement or a REPEAT statement. A# WHILE statement will keep repeating until some criterion is met, while a# REPEAT statement will only repeat the number of times specified.

# Before starting the WHILE loop, define some initial values for some of the# variables used in the loop. You must do this outside of the loop, because if they# were defined inside the loop, they would keep getting re-initialized.

# The mode variable selects one of the two algorithms used to calculate the new# height of the rod, and the iter variable is used to count the number of iterations# the macro has performed. Once the number of iterations is equal to the# maximum number of iterations specified with the max_iter variable, the macro# will stop.

Assign mode "quad"Assign iter 1

while EQ exit_flag -1

Page 33: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

Macro Examples 2-15

# The following IF statement defines the first algorithm used to calculated the new# height of the rod. This algorithm uses the results obtained from the problem’s# solution when calculating the new height.

if EQ mode "quad"

Assign d01 (Sub x1 x0)Assign d12 (Sub x2 x1)

Assign y01 (Sub y1 y0)Assign y12 (Sub y2 y1)

Assign denom (Sub (Mul d12 y01) (Mul d01 y12))

# In the following Assign command line, there are two things of note. First, notice# that there is no unique ability to square a value; instead, you must multiply the# value by itself. Second, notice the \ character in the line. This indicates that the# Assign command is continued on the next line. You may use this character with# any script command.

Assign numer (Add (Mul (Mul d12 d12) y01) \(Mul (Mul d01 d01) y12))

# The following IF statement compares the magnitude of the variable denom with# the magnitude of the variable zero. This is done to prevent a division by zero, or# a number sufficiently close to zero. Notice that there is no unique ability to take# the absolute value of a number; instead, each value is squared for comparison.

if LT (Mul denom denom) (Mul zero zero)Assign exit_flag 5

end

# The following three IF statements calculate the new height from the variable# defined previously, and test to make sure that it falls within the limits defined# initially. As you will see later in the macro, the limits change as the problem# progresses.

if EQ exit_flag -1Assign xnew (Add x1 (Mul 0.5 (Div numer denom)))

Page 34: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

2-16 Macro Examples

# Notice the commented lines in the next IF statement. If you want to track where# a macro fails or encounters an error, it is a good idea to use the Database# commands to create an error file. This way you will have a disk file that# indicates where the macro encountered a problem.

if LE xnew x0Assign exit_flag 7

# Assign error_id Newdatabase 1# Assign rowcnt DatabaseGetRows error_id# DatabaseAddRow error_id# DatabaseSetField error_id rowcnt 0 exit_flag# ExportDatabase error_id “error.dat” "yes"

end

if GE xnew x2Assign exit_flag 8

endend

end

# The following IF statement defines the second algorithm used to calculate the# new height of the rod. Results are implicitly used to set x0, x1, and x2. “Golden”# mode is invoked when the quadratic model failed to improve the function# value.

if EQ mode "golden"

Assign d01 (Sub x1 x0)Assign d12 (Sub x2 x1)

if GE d01 d12Assign xnew (Sub x1 (Mul coef d01))

end

if LT d01 d12Assign xnew (Add x1 (Mul coef d12))

endend

Page 35: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

Macro Examples 2-17

# The following IF statement uses the termination criterion,# |xnew - xold| < |epsilon|, to see if the solution has converged to the target.

if EQ exit_flag -1

Assign delta (Sub xnew x1)if LT (Mul delta delta) (Mul epsilon epsilon)

Assign exit_flag 0end

# Now that the new height for the rod has been calculated, assign the new value to# x for use in the secondary macro. Execute the secondary macro rod_param.mac,# and then assign the results to the new y value. Once the secondary macro has# finished, control shifts back to the main macro and continues from the point# where the secondary macro was executed. The results of the previous algorithm# and the secondary macro’s calculation is then written to the database file.

Assign x xnewFileExec macro_nameAssign ynew y

Assign rowcnt DatabaseGetRows db_idDatabaseAddRow db_idDatabaseSetField db_id rowcnt 0 xDatabaseSetField db_id rowcnt 1 yExportDatabase db_id db_name "yes"

# The following IF statement tests the results to make sure they fall within# acceptable parameters. If they do not, the macro stops.

if EQ ynew y1Assign exit_flag 6

endend

# Note that you are still in the original WHILE statement, checking to see whether# exit_flag is still –1.

Page 36: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

2-18 Macro Examples

# The following blocks of IF statements compare the new values with the old# values and redefines the initial values. The redefined values will be used in the# two algorithms previously defined.

if EQ exit_flag -1if LT xnew x1

if LT ynew y1Assign x2 x1Assign y2 y1Assign x1 xnewAssign y1 ynewAssign mode "quad"

endif GT ynew y1

Assign x0 xnewAssign y0 ynewAssign mode "golden"

endend

if GT xnew x1if LT ynew y1

Assign x0 x1Assign y0 y1Assign x1 xnewAssign y1 ynewAssign mode "quad"

end

if GT ynew y1Assign x2 xnewAssign y2 ynewAssign mode "golden"

endend

end

# Finally, in the case where the results never converge to a solution, use the iter# variable to end the WHILE loop. The iterations variable iter is increased by# one and the IF statement checks to see if the iter variable has surpassed the# maximum iterations variable max_iter.

Assign iter (add iter 1)

if GT iter max_iterAssign exit_flag 999

endend

Page 37: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

Macro Examples 2-19

The Secondary MacroThe secondary macro rod_param.mac is responsible for the following:● Drawing the model.● Assigning materials, boundary conditions, and solution parameters.● Generating a solution and extracting the value for S11.● Comparing the value of S11 to the desired value and calculating the

magnitude of the difference.

# This part of the secondary macro launches the 3D Modeler and draws the model.

LaunchModeler "modify"

# Before drawing any objects, the macro makes sure that there are no objects that# may interfere with the drawing process. If there were, they could cause errors in# the material and boundary setup.

Select {"*"}SelClear

# The following statements draw the objects used in the problem, saves the objects,# and exits the 3D Modeler. Notice the three sheet objects that cover surfaces on# the box object. These are used because, in a macro such as this, it is easier to# assign boundaries to objects than it is to assign them to surfaces.

Box [0, -30, 0] 100 60 100 "box2"Cyl [0, 0, 0] 2 10 x "cyl3" 12Split 0 0 { "cyl3" }Rectangle [100, 30, 0] 1 -100 100 "rect3" 1Rectangle [0, -30, 0] 0 60 100 "rect4" 1Rectangle [0, -30, 0] 1 100 100 "rect5" 1Save3d "*" "?v"Exit

# This part of the secondary macro launches the Material Manager and assigns# materials to each 3D object in the model.

LaunchMaterials "modify"MaterialAssign { "box2" } "OCS" \{ " 0.0000000000" " 0.0000000000" " 0.0000000000" }\{ " 0.0000000000" " 0.0000000000" " 0.0000000000" }

MaterialSelect "perf_conductor"MaterialAssign { "cyl3" } "OCS" \{ " 0.0000000000" " 0.0000000000" " 0.0000000000" } \{ " 0.0000000000" " 0.0000000000" " 0.0000000000" }MaterialModuleExit "save"

Page 38: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

2-20 Macro Examples

# This part of the secondary macro launches the 3D Boundary Manager and# defines the boundaries for the problem.## Notice the similar syntax used to define each boundary. Before defining a# second boundary, remember to clear the selected objects to avoid overwriting# the previous boundary.

LaunchBoundaries "modify"

ClearAllBnds

TogglePickObjByName "rect3"SetBndName "port1"SetBoundary "port"CreateBoundaryClearSelection

SetImpedanceMultiplier "0.5"

TogglePickObjByName "rect5"SetBndName "port2"SetBoundary "port"CreateBoundaryClearSelection

TogglePickObjByName "rect4"SetBndName "symm"SetBoundary "perfect_h"CreateBoundaryClearSelection

SaveBoundariesExitBoundaries

Page 39: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

Macro Examples 2-21

# This part of the secondary macro launches the Solution Setup window and# defines the solution parameters for the problem.

SolveSetupSetSolutionType 1 1 0 1 2SetSolverComputation "all_fields" "all_modes" 1SetFrequencyUnit "GHz"SetFrequency 1000000000SetAdaptiveInfo 1 "conv_delta" 30SetConvDelta 0.0001SetConvMatrix "P1M1" "P1M1" 0.1 10SetConvMatrix "P1M1" "P2M1" 0.1 10SetConvMatrix "P2M1" "P1M1" 0.1 10SetConvMatrix "P2M1" "P2M1" 0.1 10SetMeshType "initial"SaveEditableSolveParmsExitSolveSetup

# This part of the secondary macro launches the Solver and generates a solution# for the problem.

SolveNominal

# This part of the secondary macro launches the Matrix Data Post Processor and# extracts S11. Once it has the data, it uses that to calculate the new y value.

PostMatrixData

Assign S11_mag Component 1 SzgDataMatrixValue "MP""A_1" 0 \ "S" 1 1 1 1

# The following statements calculate the new y value by subtracting the target S11# value (0.5) from the actual S11 value and squaring this difference. When this# difference becomes small enough, the macro will stop.

Assign ytemp Sub S11_mag 0.5Assign y (Mul ytemp ytemp)

SzgDataKernelExit "save"

Page 40: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Macro Example — An Optimization Macro

2-22 Macro Examples

Page 41: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Command Set 3-1

3

Default Command Set

This chapter describes the programming script commands, the Default com-mand set. These commands are available in every module.

Page 42: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-2 Default Command Set

Default Module Script CommandsThe following commands are listed under the Default command set.

Add

Use: Adds two values together and echoes them on the screen. If applied tostrings, this command performs a string concatenation. If applied to Pos2,Vec2, Pos3, or Vec3, it combines the components by component addition.

Command: none

Syntax: add value1 value2

Note: The values can be entered as strings and are used in a macro to combinetwo values.

Example: add sheet1 sheet2

This example adds the existing values of sheet1 and sheet2 in the macro.Assign

Use: Assigns a value to a variable. Use the Help script command to view anydefined variables.

Command: none

Syntax: assign variable value

Note: The value can be any data type, but it is saved in string form.Example: Assign NAME Getstring “Enter a name for the object”

This example echoes the character string “Enter the name for the object”and then awaits input from the keyboard. The entered text is assigned tothe variable NAME.

ClearAll

Use: Clears both the variables and functions defined in the commandlanguage.

Command: none

Syntax: clearall

ClearFunctions

Use: Deletes any functions defined in the command language.Command: none

Syntax: clearfunctions

☞Note: When using variable names with other script commands, do not put the

variable name in quotes as you would most string values.

Page 43: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-3

ClearVars

Use: Deletes all the variables defined in the command language.Command: none

Syntax: clearvars

ComplexFormat

Use: Formats a complex number to magnitude-phase (radians or degrees) orreal-imaginary.

Command: none

Syntax: complexformat “input format” “output format”<xval,yval>

Note: “input format” and “output format”:MPR=magnitude-phase (radians)MPD=magnitude-phase (degrees)RI=real-imaginary

Example: complexformat “ri” “mpd” <1,1>

This example formats the complex number with real and imaginary com-ponents of 1 to magnitude-phase (degrees).

Component

Use: Extracts a vector or position component or member of a list from thegiven position.

Command: none

Syntax: component which_component “position/vector”

Note: which_component: 1=x, 2=y, 3=z, number=positionExample: component 3 [5,10,15]

This example extracts the z-component from a point, which would be 15.component 2 {“oak” “maple” “beech” “sycamore”}

This example extracts the second component from a string list, whosevalue would be maple.

ComponentCount

Use: Returns the number of components in a position, vector, or list.Command: none

Syntax: componentcount position_vector_or_list

Example: componentcount [5,10,15]

This example returns the value of 3.

Page 44: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-4 Default Command Set

DatabaseAddRow

Use: Adds a row to the specified database. This does not affect the databasefile stored on the hard disk. Use this after creating a new database filewith NewDatabase, or after importing a database file withImportDatabase.

Command: none

Syntax: databaseaddrow “database name”

DatabaseGetColumns

Use: Returns the number of columns in the specified database.Command: none

Syntax: databasegetcolumns “database name”

Example: newdatabase 6 “tmp”databasegetcolumns “tmp”

This example creates a new database with 6 column. The example thenreturns the number of columns in the database (which should be 6).

The two expressions in the example would normally be separated byintervening expressions, since it wouldn’t make sense to create the num-ber of columns, then ask what that number is in the next statement.

DatabaseGetField

Use: Returns the value of the specified field from database file.Command: none

Syntax: databasegetfield “dbase name” row column

Note: row and column: Numbering begins at zero.Example: newdatabase 6 “tmp”

databasegetfield “tmp” 5 2

This example creates a new database with 6 columns. The example thenreturns the value from the sixth row and third column of the database.

The two expressions in the example would normally be separated byintervening expressions, since it wouldn’t make sense to create a new,empty database, then ask what that the value of a field is in the next state-ment.

☞Note: The first two lines of the database file must be the number of rows followed

by the number of columns. For example, if a database file contains 16 rowsand 3 columns, the first line of the database file must be:

16 3

Page 45: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-5

DatabaseGetRows

Use: Returns the number of rows in the specified database.Command: none

Syntax: databasegetrows “dbase name”

Example: newdatabase 6 “tmp”databasegetrows “tmp”

This example creates a new database with 6 columns. The example thenreturns the number of rows in the database (which should be 0).

The two expressions in the example would normally be separated byintervening expressions, since it wouldn’t make sense to create a new,empty database, then ask how many rows it has in the next statement.

DatabaseSetField

Use: Replaces a value in a database with the value you specify. This exampleonly affects databases currently in memory. To save the database, use theExportDatabase command.

Command: none

Syntax: databasesetfield “dbase name” row column “new value”

Note: Rows and columns start at 0, not at 1.Example: newdatabase 6 “dbase name”

...databasesetfield “dbase name” 0 0 “force”

This example creates a new database with 6 columns. The example thenreplaces the value in the first row, first column of the database with thenew value of force.

DeleteDatabase

Use: Deletes the database currently stored in memory. This does not affect thedatabase file stored on your hard disk.

Command: none

Syntax: deletedatabase “dbase name”

Div

Use: Divides two defined values in a macro.Command: none

Syntax: div value1 value2

Page 46: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-6 Default Command Set

DoubleListSetComponent

Use: Returns a new list of double-precision floating-point numbers, using apreviously existing list, a specified value, and a position in the list. If thevalue of component is – 1, the value is appended to the new list. Addedcomponents may be literal values or variables which evaluate to literalvalues.

Command: none

Syntax: doublelistsetcomponent list value component

Note: list is a double list: {DOUBLE1 DOUBLE2...}

DumpDatabase

Use: Dumps the contents of a user database.Command: none

Syntax: dumpdatabase “dbase name” start_row end_row start_colend_col

Example: dumpdatabase “tmp” 2 1 2 1 2

This example dumps the first two rows and columns of the second data-base named tmp.

Echo

Use: Echoes text or the results of script commands to the command promptwindow. Use the echo command to view the results calculated by otherscript commands. Otherwise they do not appear.

Command: none

Syntax: echo [“text” or script_command_result]

Example: echo component 3 [5,10,15]

This example displays the results of the component command, 15, in thecommand prompt window.

EQ

Use: Allows you to determine if two entered values are equal. This can applyto strings or numerical values.

Command: none

Syntax: eq value1 value2

The software will return a 1 of the arguments are equal.

Page 47: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-7

Error

Use: Stops the execution with the error message you specify.Command: none

Syntax: error “message”

Example: error “The length of the box has exceeded 20”

This example prints out the string, “The length of the box has exceeded20” to the command prompt window and stops the macro execution.

EvaluateExpression

Use: Evaluates the defined expression. The default persistent setting is 0 (thus,the value is not persistent). If the value is persistent and the expressiontakes the form “x=value”, x will be entered as a variable in the persistenttable and is usable when evaluating subsequent persistent expressions. Asubsequent expression may then have the form “value +x”.

Command: none

Syntax: evaluateexpression “expression” persistent?(y/n)

Note: Persistent: 0 (not persistent) or 1 (persistent)Example: evaluateexpression “x=5” 1

This takes the persistent value of x=5, and allows x to be treated as a vari-able in subsequent expressions.

ExportDatabase

Use: Saves the specified database to a disk file.Command: none

Syntax: exportdatabase “dbase name” “file name and location”“overwrite?”

Note: overwrite: “yes” or “no”Example: exportdatabase “tmp” “/hfss/macros/wgdata.dat” “yes”

This example saves the database tmp currently stored in memory to thedisk file wgdata.dat in the /hfss/macros/ directory. The system is instructedto overwrite the old file.

FileClose

Use: Closes a file that was open for formatted reading.Command: none

Syntax: fileclose “file name”

Page 48: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-8 Default Command Set

FileExec

Use: Executes a macro or commands from a file.Command: none

Syntax: fileexec “file name”

FileExecErrExitIf

Use: Verifies the preconditions in an executing macro file.Command: none

Syntax: fileexecerrexitif “condition command” “error message”

Note: condition command: any conditional statement such as if.Example: fileexecerrexitif “IF EQ test2 test” “The test values

are equal and will produce a linear curve.”

In this example, if the two test values are equal in this hypothetical postprocessing macro, the error message “The test values are equal and willproduce a linear curve.” appears and ends the macro.

FileExecPause

Use: Displays an informational message during macro execution. The usermust choose OK from the message window to continue with the macro.The message can have more than one line if you use “\n” as a newlinecharacter.

Command: none

Syntax: fileexecpause “text message”

Example: fileexecpause “First part of macro finished.\n Continuing.”

FileExists

Use: Returns whether a given file exists.Command: none

Syntax: fileexists “filename”

Example: fileexists “Iverify.mac”

Determines and returns whether Iverify.mac exists in the current direc-tory.

FileOpen

Use: Opens a file for formatted reading. This command will produce an error ifit is executed directly from the command line. It will only be permittedfrom within an executing macro file. If the file cannot be opened, an errorcondition will be set. The file will remain open until you explicitly close itor until the executing macro file terminates. This command may only beused for formatted reading from files.

Command: none

Syntax: fileopen “filename”

Page 49: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-9

FileRead

Use: Performs a formatted read from a file. The format_string is an fscanf stylestring, but with different variable format indicators, intended forcommand language usage. Regular characters require an exact match.Variables are indicated by the “$$”. When reading in a variable, the fileposition moves forward to the first non-blank character before attemptingthe variable read. After the variable is read, the file position steps forwardto the first character following the variable. For delimited strings, this isthe first character after the terminating double quote or whitespacecharacter (the next line if no terminating delimiter is found). For doublevalues, formats like 12.345e-02 are recognized.

Command: none

Syntax: fileread “filename” “format string”

Note: The return value is a string list.Note: Specific formats supported are as follows:

$$l Long value.

$$d Double value.

$$mmm String value, using exactly mmm literal characters, countingwhite space as characters. For example, $$12.

$$s Character delimited string value with a maximum length of1024: if starts with double quote ends at either end of line or first double quote else ends at first white space character (or end of line)

$$[xxx] Skip any number of characters denoted by x. If x is a blank, thiswill denote any white space (tab, blank, newline, carriagereturn). For example, $$[ab].

$$[^xxx] Skip any number of characters until first of xxx encountered.

$$”xxx” Skip until directly after first occurrence of literal substring, or tothe end of the file if not found. To use this format specifier, youwill have to enclose the entire format string in single quotes, sothat the double quotes are not interpreted as the end of the for-mat string.

Page 50: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-10 Default Command Set

FileRecord

Use: Starts recording the subsequent commands to a macro file. If the filealready exists, you will be asked whether to overwrite it.

Command: none

Syntax: filerecord “file name”

Example: filerecord “Iverify.mac”

This example records your subsequent actions to the file Iverify.mac.FileRecordAppend

Use: Starts recording the subsequent commands and appends them to a macrofile. If the macro file doesn’t exist, it will be created.

Command: none

Syntax: filerecordappend “file name”

Example: filerecordappend “Iverify.mac”

This example appends your subsequent actions to the macro fileIverify.mac.

☞Note: In all literal character specifiers, comparisons will be sensitive to upper/

lower case exact match. In the [xxx] and [^xxx] formats, you may useranges of characters, such as [a-hm-z]. For example:

The $$s$$L$$[a-z ]$$d$$s$$s.

when applied to the following input string:

The brown 4 foot high dog ate 2.5 pounds “of meat”.

will produce the following output:

variable 1 (string): “brown”

variable 2 (long): 4

skipped string: “foot high dog ate “

variable 3 (double): 2.5

variable 4 (string): “pounds”

variable 5 (string): “of meat”

All values to be read will be converted to string format, and the commandwill store them into a return string list. The number of values successfullyread will be indicated by the number of components in the returned stringlist.

Page 51: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-11

FileRecStop

Use: Stops recording to a macro file.Command: none

Syntax: filerecstop

FileWrite

Use: Performs a formatted write to a file. For formatted write, the file isopened, the data written, and the file is then closed on each writeoperation.

Command: none

Syntax: filewrite “filename” “write_mode” “format” [arg_list]

Note: filename is a STRING containing the name of the formatted filewrite_mode is a STRING; either w (overwrite) or a (append)format is a STRING with literal contents plus $$ variable insertionindicators. When defining the format, use \n for new lines.arg_list is a STRING_LIST containing the arguments to be matchedagainst the variable insertion indicators in order.

FuncDef

Use: Defines a function. The function definition can reference arguments thatwill be input from the command prompt if they are not supported on theend line, when the macro is run.

Command: none

Syntax: funcdef function_name [text or script_command_results]

Example: funcdef IncrVar assign $1 (add $1 1)

This example defines the function IncrVar, which takes a variable namefrom the command prompt and adds 1 to its value. Thus, to add 1 to avariable named year:assign year 1999incrvar year

The value of newyear is 2000.FuncHelp

Use: Adds help strings to an existing function.Command: none

Syntax: funchelp “function name” “help strings”

Example: funchelp “t” “This is the sum of the variables u and v”

This example defines the help for function t. When you use help functions,this description will appear for the function t.

Page 52: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-12 Default Command Set

FuncSave

Use: Saves all functions to a file readable by FileExec.Command: none

Syntax: funcsave “file name”

Example: funcsave “t.mac”

This example saves the defined functions to a file named t.mac. If youexecute this file using the FileExec command, the functions saved in thefile are defined for the current project.

FuncUndef

Use: Removes a function definition.Command: none

Syntax: funcundef “function name”

Example: funcundef “t”

This example undefines the function t.GE

Use: Returns a value of 1 if the first argument is greater than or equal to thesecond argument.

Command: none

Syntax: ge argument1 argument2

Note: GE arguments can be strings or numerical values.If argument1 is greater than argument2, the software returns a value of 1in the command prompt window.

GetDateAndTime

Use: Returns the current date and time.Command: none

Syntax: getdateandtime

GetFileList

Use: Returns a list of files that match a specified search pattern.Command: none

Syntax: getfilelist “search_pattern”

Page 53: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-13

GetFileName

Use: Opens a file dialog to get a filename from the user.Command: none

Syntax: getfilename “rw” “prompt” “filter” “title”

Note: RW is either “r” for read or “w” for write.Prompt is the file prompt.Filter is the file filter.Title is the dialog title set to “Select file” by default.

GetMacroPath

Use: Returns the full path of a macro file.Command: none

Syntax: getmacropath “file name”

GetMacroPathList

Use: Returns the macro path list.Command: none

Syntax: getmacropathlist

GetProductId

Use: Returns the product ID number for the current project. For HFSS, theproduct ID number is 13.

Command: none

Syntax: getproductid

GetUserOption

Use: Returns the value of a defined user option.Command: none

Syntax: getuseroption “category” “option name”

Note: Category: The category of the user optionOption name: The name of the user option.

GetVersion

Use: Returns the version number of the software for the project.Command: none

Syntax: getversion

Page 54: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-14 Default Command Set

Global

Use: Returns the value of a global variable.Command: none

Syntax: global “variable name”

GlobalAssign

Use: Assigns a value to a global variable.Command: none

Syntax: globalassign “variable name” “value”

Note: The assigned value is a string.Example: globalassign “path1” “x”

This example assigns the value of x to path1.GT

Use: Returns a value of 1 if the first argument is greater than the secondargument.

Command: none

Syntax: gt “argument1” “argument2”

Note: GT arguments can be either strings or numerical values.Help

Use: Provides help about an available item or list.Command: none

Syntax: help “item name, commands, functions, or variables”

Example: help functions

This example lists all the functions defined for the current project.ImportDatabase

Use: Imports a user database file. The first line of the database file mustcontain the number of rows and the number of columns.

Command: none

Syntax: importdatabase “file name” “dbase name”

Example: importdatabase “c:/hfss/wgdatabase.dat” “tmp”

This example imports the database wgdatabase.dat. The database can nowbe referred to by the name “tmp.”

Page 55: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-15

ImportRawDatabase

Use: Imports a user database file. The information must be organized intorows and columns, and each row must occupy a single line. TheImportRawDatabase command computes the number of rows andcolumns and stores it in memory. (Unlike the ImportDatabase command,the first row should not contain the number of rows and columns.)

Command: none

Syntax: importrawdatabase “file name” “dbase name”

Example: importrawdatabase “c:/hfss/rawdatabase.dat” “tmp”

This example imports the database rawdatabase.dat. The database cannow be referred to by the name “tmp.”

IsCommandEnabled

Use: Returns whether a command is enabled in the current context. The returnvalue is either a 1 (true) or a 0 (false).

Command: none

Syntax: iscommandenabled “command name”

Example: iscommandenabled “help”

If the help command is enabled, this value is 1, otherwise, it is 0.LE

Use: Returns a value of 1 if the first argument is less than or equal to thesecond argument.

Command: none

Syntax: le argument1 argument2

Note: LE arguments can be either strings or numerical values.Log10

Use: Returns the log base 10 value of the entered number.Command: none

Syntax: log10 value

Example: log10 300

This returns a value of 2.4771212.LT

Use: Returns a value of 1 if the first argument is less than or equal to thesecond argument.

Command: none

Syntax: lt argument1 argument2

Note: LT arguments can be strings or numerical values.

Page 56: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-16 Default Command Set

Minus

Use: Negates the given value.Command: none

Syntax: minus value

Mul

Use: Multiplies two values together.Command: none

Syntax: mul argument1 argument2

Note: Mul arguments can be strings or numerical values.Example: mul line1 base1

In this example, the values of line1 and base1 are multiplied together.NE

Use: Returns a value 1 of in the command prompt window if the two namedvalues are not equal.

Command: none

Syntax: ne argument1 argument2

Note: NE arguments can be strings or numerical values.Example: ne line1 line2

In this example, if line1 is 15 and line2 is 25, the command prompt win-dow will display a 1.

NewDatabase

Use: Creates a new database with the number of columns you specify. Use theDatabaseAddRow and DatabaseSetField commands to add rows andvalues to the new database. Save the database to a disk file using theExportDatabase command.

Command: none

Syntax: newdatabase number_of_columns “dbase name”

Example: newdatabase 6 “tmp”

This example creates the new database “dbase name” in memory, with6 columns. The database can now be referred to by the name “tmp.”

OR

Use: Returns a value 1 of in the command prompt window if either of the twonamed values is non-zero.

Command: none

Syntax: or argument1 argument2

Note: OR arguments can be strings or numerical values.

Page 57: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-17

ParametricFileExec

Use: Executes parameterized commands from a file. Support is also providedfor parameterized macro files.

Command: none

Syntax: parametricfileexec “filename” {variable/value pairs}

Note: variable/value pairs: a string list containing pairs of strings forvariable name and variable value.

Example: ParametricFileExec “3dmodel.mac” {“pair1” “pair2”}

This example executes the 3dmodel.mac file using the pair1 and pair2value pairs.

You can also control whether you record the contents of a file as it exe-cutes, and whether commands echo to the command window as a fileexecutes, using the following: SetRecordingEnabled state SetEchoEnabled state where state is a LONG value of 1 for enabled or 0 for disabled.

When using this command, default values can be indicated in the macrofile to be executed. Variables that are in variable/value pairs willbe set as indicated. Other variables indicated in the default list willreceive those values. Both type of assignments will be private and will beremoved automatically when the file finishes execution.The macro file default values should be in a commented header as fol-lows: # BeginParameters # Assign varname1 value1 # Assign varname2 value2 . . # EndParameters

Page 58: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-18 Default Command Set

Pos2

Use: Specifies the x- and y-coordinates of a 2D position. This is typically usedas part of a drawing command.

Command: none

Syntax: pos2 x_argument y_argument

Example: pos2 2 4

This example defines a position x = 2 and y = 4.Pos3

Use: Specifies the coordinates of a 3D position; you must specify values for x,y, and z.

Command: none

Syntax: pos3 x_argument y_argument z_argument

Example: pos3 2 4 8

This example defines a 2D position with an x-coordinate of 2, a y-coordi-nate of 4, and a z coordinate of 8.

Pos3Dist

Use: Returns the Euclidean distance between two 3D positions.Command: none

Syntax: pos3dist [argument1] [argument2]

Example: pos3dist [2,2,2] [2,2,4]

This example calculates the distance between the point (2,2,2) and thepoint (2,2,4), which is 2.

PrependMacroPath

Use: Adds a directory to the front of the macro path list.Command: none

Syntax: prependmacropath “directory name”

PrintHelp

Use: Prints all the commands to a text file.Command: none

Syntax: printhelp “file name”

PrivateAssign

Use: Assigns a value to a private variable.Command: none

Syntax: privateassign variable_name “value”

Page 59: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-19

ProtectedAssign

Use: Assigns a value to a protected variable.Command: none

Syntax: protectedassign variable_name “value”

RandomFraction

Use: Generates and displays a pseudo-random number between 0 and 1,displaying it to the fifteenth decimal place.

Command: none

Syntax: randomfraction

RemoveMacroPath

Use: Removes a directory from the macro path list.Command: none

Syntax: removemacropath “directory name”

SetEchoEnabled

Use: Regulates the command window printer within the current macro file.Command: none

Syntax: setechoenabled enabled

Note: enabled: 0 for disabled, 1 for enabledSetMacroPathList

Use: Sets the macro path list.Command: none

Syntax: setmacropathlist “directory list”

SetRecordingEnabled

Use: Regulates recording within the current macro file.Command: none

Syntax: setrecordingenabled enabled

Note: enabled: 0 for disabled, 1 for enabledSetUnitsOfQuant

Use: Changes the units of a quantity.Command: none

Syntax: setunitsofquant “quantity” “units”

Example: setunitsofquant “Current” “A”

This example sets the units for the current source being defined in the 3DBoundary Manager to amperes.

Page 60: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-20 Default Command Set

SetUserOption

Use: Defines the user option value.Command: none

Syntax: setuseroption “category” “option name” “option value”

Note: category: The category of the user option.option name: The name of the option.option value: The value of the user option.

Example: setuseroption “hfss” “min_adaptive_passes” “0”

This example sets the minimum number of adaptive passes to 0 for theHFSS project.

Sleep

Use: Sleeps (pauses) the module for a given number of seconds. No activityoccurs during a sleep.

Command: none

Syntax: sleep SECONDS

Example: sleep 10 filerecord “Iverify.mac”

This example pauses the system for 10 seconds and then begins recordinga macro to the file Iverify.mac.

StrConcat

Use: Concatenate two strings.Command: none

Syntax: strconcat “string1” “string2”

Example: assign framenum 5

assign framelist {}WHILE framenum

assign newstring (StrConcat “Frame“ framenum)assign framenum SUB framenum 1assign framelist stringlistsetcomponent framelist\

newstring -1

END

This example joins together the text string “Frame” with the variableframenum. As the frame number is reduced, each new text string is addedto the list of frames, so the final list is {“Frame5”, “Frame4”, “Frame3”,“Frame2”, “Frame1”}.

Page 61: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

Default Command Set 3-21

String

Use: Converts arguments to a string.Command: none

Syntax: string arguments

StringListSetComponent

Use: Sets a string list entry. The modified list is the return value of thecommand. If the component has a value of -1, the new value is appendedto the list. The string list may be an empty list if you are creating a newstring list by adding the first component. Added components may bestring data, variables with string contents, or anything convertible tostrings.

Command: none

Syntax: stringlistsetcomponent {list} “string” component

Note: LIST is a string list: {“string1” “string2” ...}Example: Assign new_list StringListSetComponent new_list

“entry2” “boxdims”

This defines string list entry2 with the component of boxdims.Strlen

Use: Returns the length of a string.Command: none

Syntax: strlen “string name”

Strstr

Use: Finds a substring within a string.Command: none

Syntax: strstr “string” “substring” starting_position

Note: starting position: the position from which to begin the search. Bydefault this is set to 0 to search at the beginning of the string. The returnvalue is 0-based index or - 1 if not found.

Sub

Use: Subtracts two values.Command: none

Syntax: sub argument1 argument2

Note: Subtracted arguments can be either string or numerical values.

Page 62: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Default Module Script Commands

3-22 Default Command Set

Substring

Use: Extracts a substring from a string.Command: none

Syntax: substring “string” start_position end_position

Note: start_position: The numerical start position of the string.end_position: The numerical end position of the string.

Unassign

Use: Removes a variable definition.Command: none

Syntax: unassign variable name

Example: unassign xlength

This example removes the variable xlength.Vec2

Use: Converts scalar values to a 2D vector (x- and y-components) which can beused for another command.

Command: none

Syntax: vec2 x_component y_component

Example: vec2 2 2

This example creates the vector <2,2>.Vec3

Use: Converts scalar values to a 3D vector (x-, y-, and z-components).Command: none

Syntax: vec3 x_component y_component z_component

XOR

Use: Returns a value of 1 if exactly one of the entered arguments is non-zero.Command: none

Syntax: xor argument1 argument2

Note: Arguments can be either string or numerical values.Example: xor line1 point1

If line1 is 10 mm and point1 is 0mm, the command prompt window willreturn a value of 1.

Page 63: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Generic Script Commands 4-1

4

Generic Script Commands

This chapter describes the generic script commands that aren’t specific to anyone module. They are generally loaded in every module; however, since someof the commands are not applicable to some modules, those commands willnot be available. Refer to Appendix A: “Module Script Commands,” for acomplete list of the commands available in each module.The generic script commands include the following command sets:● Generic module● mod3proj● mod3view

Page 64: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Generic Module Script Commands

4-2 Generic Script Commands

Generic Module Script CommandsThe following script commands are classified as Generic Module script com-mands.

CascadeAll

Use: Cascades all project and view windows.Command: Window/Cascade

Syntax: cascadeall

CascadeProjects

Use: Cascades all project windows.Command: none

Syntax: cascadeprojects

CascadeViews

Use: Cascades all view windows.Command: none

Syntax: cascadeviews

CloseWindow

Use: Closes the active view window.Command: Window/Close

Syntax: closewindow

ModuleIsPromptVisible

Use: Tests if the Command Prompt window is visible.Command: none

Syntax: moduleispromptvisible

ModulePrefsRevert

Use: Reverts set preferences for the current module to their default values.Command: none

Syntax: moduleprefsrevert

ModuleSavePrefs

Use: Saves the currently defined user preferences for the current module.Command: View/Save Module Preferences

Syntax: modulesaveprefs

Page 65: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Generic Module Script Commands

Generic Script Commands 4-3

ModuleSidewinLeft

Use: Moves the side window to the left of the screen.Command: View/Side Window/Left

Syntax: modulesidewinleft

ModuleSidewinRight

Use: Moves the side window to the right of the screen.Command: View/Side Window/Right

Syntax: modulesidewinright

ModuleToggleMessage

Use: Toggles the visibility of the status bar.Command: none

Syntax: moduletogglemessage

ModuleTogglePrompt

Use: Toggles the visibility of the Command Prompt window.Command: View/Command Prompt

Syntax: moduletoggleprompt

ModuleToolbar(direction)

Use: Moves the tool bar to either the top, bottom, left, or right of the window.Command: View/Toolbar

Syntax: moduletoolbarbottom, moduletoolbartop,moduletoolbarleft, moduletoolbarright

ModuleToolbarHide

Use: Hides the tool bar.Command: View/Toolbar

Syntax: moduletoolbarhide

NewWindow

Use: Creates a new view window.Command: Window/New

Syntax: newwindow

PrintEntire

Use: Prints contents of entire module window.Command: none

Syntax: printentire

Page 66: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Generic Module Script Commands

4-4 Generic Script Commands

PrintProj

Use: Prints all the view windows for the current project. (PC only)Command: none

Syntax: printproj

PrintRect

Use: Prints the rectangular area you select using the mouse.Command: none

Syntax: printrect

PrintSubwin

Use: Prints the subwindow you select using the mouse.Command: none

Syntax: printsubwin

PrintView

Use: Prints all the view windows for the current project. (PC only)Command: none

Syntax: printview

TileAllGrid

Use: Tiles all project and view windows in a grid.Command: Window/Tile

Syntax: tileallgrid

TileAllHrz

Use: Tiles all view windows horizontally.Command: none

Syntax: tileallhrz

TileAllVrt

Use: Tiles all view windows vertically.Command: none

Syntax: tileallvrt

TileProjectsGrid

Use: Tiles all projects in a grid.Command: none

Syntax: tileprojectsgrid

Page 67: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Generic Module Script Commands

Generic Script Commands 4-5

TileProjectsHrz

Use: Tiles all projects horizontally.Command: none

Syntax: tileprojectshrz

TileProjectsVrt

Use: Tiles all projects vertically.Command: none

Syntax: tileprojectsvrt

TileViewsGrid

Use: Tiles all view windows in a grid.Command: none

Syntax: tileviewsgrid

TileViewsHrz

Use: Tiles all view windows horizontally.Command: none

Syntax: tileviewshrz

TileViewsVrt

Use: Tiles all view windows vertically.Command: none

Syntax: tileviewsvrt

Page 68: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

4-6 Generic Script Commands

mod3proj Script CommandsThe following script commands are classified as mod3proj script commands.

AbortTimeout

Use: Sets the time-out, in milliseconds, for aborting a refresh of a 3D viewwindow. When the software is refreshing a window, the user is not ableto move (rotate, pan, and so forth) the object in the window. Setting theabort time-out sets the amount of time that the software will spendrefreshing a window before allowing the user to move the object.

Command: none

Syntax: aborttimeout TIME

ActivateView

Use: Activates the specified window.Command: none

Syntax: activateview nn

Example: activateview 2

This example activates the second view window.CheckOverlap

Use: Checks if any sheet or solid objects intersect each other.Command: Options/Check Overlap

Syntax: checkoverlap

DeleteCS

Use: Deletes a coordinate system with the specified name.Command: Coordinates/Delete

Syntax: deletecs “coordinate system name”

Example: deletecs “coord1”

This example deletes the coordinate system coord1.Deselect

Use: Deselects objects in the model.Command: Edit/Deselect All

Syntax: deselect “object name”

Example: deselect “box1”

This example deselected the selected object box1 in the model.

Page 69: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

Generic Script Commands 4-7

DispShaded

Use: Displays an object in flat shaded mode.Command: none

Syntax: dispshaded “object name”

Example: dispshaded “box1”

This example displays the object box1 in flat shaded mode.DispWire

Use: Displays an object in wire frame mode.Command: none

Syntax: dispwire “object name”

Example: dispwire “box1”

This example displays the object box1 as a wire frame.FlushEvents

Use: Forces the 3D Post Processor to display all calculated plots. Normally, thecalculated plots are not displayed until the script has finished running orthere is a pause in the macro (such as the sleep command).

Command: none

Syntax: flushevents

GetCurPos

Use: Returns the current position (the blinking marker in the active viewwindow) in local coordinates.

Command: none

Syntax: getcurpos

GetDouble “Prompt”

Use: Prompts the user for a real value with the specified prompt and returns itto the script.

Command: none

Syntax: getdouble “prompt name”

Example: animationsetstartvalue getdouble “enter the startvalue for the animation plot:”

This example prompts the user for a value and assigns it as the start valuefor the variable of the animation plot. The text to the left of the promptwill read “Enter the start value for the animation plot:”.

Page 70: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

4-8 Generic Script Commands

GetLong “Prompt”

Use: Prompts the user for an integer value with the specified prompt andreturns it to the script.

Command: none

Syntax: getlong “prompt name”

Example: assign intval getlong “enter an integer:”

This example prompts the user for a value and assigns IntVal the enteredvalue. The text left of the prompt will read “Enter an Integer:”.

GetNumObjects

Use: Returns the total number of objects in the project including invisibleobjects and background objects.

Command: none

Syntax: getnumobjects

GetNumVIews

Use: Returns the total number of view windows.Command: none

Syntax: getnumviews

GetObjectName

Use: Returns a string that uses this object name.Command: none

Syntax: getobjectname object_number

Note: object_number: A sequential number from one to the GetNumObjectsvalue. If the object_number is out of range, an empty string is returned.

Example: echo getobjectname 1

This example displays the object name for the first object.GetOrigin

Use: Returns the coordinate system origin in global coordinates.Command: none

Syntax: getorigin

Page 71: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

Generic Script Commands 4-9

GetPosition “Prompt”

Use: Prompts the user for a 3D position with the specified prompt and returnsit to the script. You may enter the position at the command prompt orclick the left mouse button on the point in the active view window.

Command: none

Syntax: getposition “prompt name”

Example: assign vertex1 getposition “enter the position for thefirst vertex:”

This example prompts the user for a 3D position and assigns it to the vari-able vertex1. The text left of the prompt will read “Enter the position forthe first vertex:”.

GetString “Prompt”

Use: Prompts the user for a string with the specified prompt and returns it tothe script.

Command: none

Syntax: getstring “prompt name”

Example: assign name getstring “enter a name for the object:”

This example prompts the user to enter a name and assigns that stringvalue to the variable NAME.

GetUnitConv

Use: Gets the unit conversion factor from meters. For example if you are inmillimeters, the unit conversion factor returned is 1000.

Command: none

Syntax: getunitconv

GetUnitName

Use: Gets the name of the current units.Command: none

Syntax: getunitname

GetVector “Prompt”

Use: Prompts you for an integer value with the specified prompt and returns itto the script. You may enter the vector at the command prompt or clickthe left mouse button in the active view window to choose the vectorpoints.

Command: none

Syntax: getvector “prompt name”

Example: assign vector1 getvector “enter the vector:”

This example prompts you for a vector and assigns it to the variablevector1.

Page 72: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

4-10 Generic Script Commands

GlobalCS

Use: Switches to a global (absolute [0,0,0] unrotated) coordinate system.Command: Coordinates/Global

Syntax: globalcs

Hide

Use: Makes the specified object invisible.Command: none

Syntax: hide “object name”

Example: hide “box1”

This example hides the object called box1.HideOrient

Use: Hides an object’s orientation (the object’s local XYZ system).Command: none

Syntax: hideorient “object name”

Example: hideorient “box1”

This example hides the object coordinate system of the object box1.HideRegion

Use: Hides the problem region if it is visible.Command: none

Syntax: hideregion

HideSel

Use: Hides the selected objects.Command: none

Syntax: hidesel

List

Use: Lists the objects in the modeler database.Command: none

Syntax: list

LocalCS

Use: Switches to the local coordinate system.Command: Coordinates/Local

Syntax: localcs

Page 73: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

Generic Script Commands 4-11

Lorigin

Use: Moves the local coordinate system’s origin to a new location.Command: none

Syntax: lorigin [local coordinates]

Example: lorigin [10,10,10]

This example moves the local coordinate system’s origin to [10, 10, 10] ofthe local coordinate system.

ObjectCS

Use: Makes the local coordinate system of an object the same as the localcoordinate system.

Command: Coordinates/Show ObjectCS

Syntax: objectcs “object name”

ObjectExists

Use: Checks for the existence of an object in the model.Command: none

Syntax: objectexists “object name”

Example: if objectexists “coil”dispshaded “coil”

Note: This example checks to see if the object named coil exists and if it does,the object is filled with a solid shading to make it more easily discerniblein the model. The ObjectExists command is used primarily in creatingmacros with conditions.

Origin

Use: Moves the global coordinate system’s origin to a new location.Command: Coordinates/Move Origin

Syntax: origin [global coordinates]

Example: origin [10,10,10]

This example moves the global coordinate system’s origin to [10, 10, 10]of the global coordinate system.

Origin?

Use: Displays the coordinates of the current global origin.Command: none

Syntax: origin?

PrintProj

Use: Prints all the view windows for the current project.Command: none

Syntax: printproj

Page 74: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

4-12 Generic Script Commands

PrintView

Use: Prints the active view window.Command: none

Syntax: printview

Recolor

Use: Changes the color of an object to a newly defined color. The red, green,and blue values range from 0 to 255.

Command: none

Syntax: recolor “object name” redvalue greenvalue bluevalue

Note: redvalue: 0-255greenvalue: 0-255bluevalue: 0-255

Example: recolor “box1” 255 0 0

This example changes the color of the object box1 to red.RestoreCS

Use: Restores a saved local coordinate system.Command: none

Syntax: restorecs “coordinate system name”

RotateCS

Use: Rotates the local coordinate system about a vector by the specified angleof rotation.

Command: none

Syntax: rotatecs <vector to rotate about> angle

Example: rotatecs <0,0,10> 45

This example rotates the local coordinate system 45 degrees around the z-axis.

RotatedCS

Use: Switches to the most recently rotated coordinate system, preserving theorigin.

Command: Coordinates/Rotated

Syntax: rotatedcs

SaveCmdWin

Use: Saves the contents of command window to a text file. This is extremelyuseful when you wish to have a hardcopy of the contents of the commandwindow.

Command: none

Syntax: savecmdwin “file name”

Page 75: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

Generic Script Commands 4-13

SaveCS

Use: Saves the current local coordinate system’s definition.Command: Coordinates/Save

Syntax: savecs “coordinate system name”

SaveWindow

Use: Saves the current active view window to a file.Command: none

Syntax: savewindow “file name” file_type

Note: file_type: Select from the following.

Example: savewindow “plot1.gif” 2

This example saves the plot to a .gif file called plot1.gif.Select

Use: Selects objects.Command: Edit/Select

Syntax: select “object names”

Example: select { “layer1” “layer2” “layer3” }

This example selects the three objects called layer1, layer2, and layer3.You don’t need the braces if you are only selecting one object.

Example: select { “+layer4” “-layer1” }

This example selects the object called layer4 and deselects the previouslyselected object layer1.

Number File type

0 bmp1 ppm2 gif3 pict4 rgb5 tiff6 ps

Page 76: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

4-14 Generic Script Commands

SelInBox

Use: Selects objects located within a box.Command: none

Syntax: selinbox [base vertex] sizex sizey sizez

Example: selinbox [0,0,0] 10 10 10

This example selects all objects in a box starting at the origin and extend-ing 10 units in the positive x, y, and z directions.

SetCurPos

Use: Sets the cursor position in global CS.Command: none

Syntax: setcurpos <x,y,z>

Note: Coordinates are entered in the global coordinate system.Example: setcurpos <0,0,50>

This example places the cursor on the z axis at [0,0,50].SetObjectCS

Use: Makes an object coordinate system the same as the local coordinatesystem.

Command: Coordinates/Set Object CS

Syntax: setobjectcs “object name”

Example: setobjectcs “box1”

This example sets the object coordinate system for the object box1 to thelocal coordinate system.

Show

Use: Shows a hidden object.Command: Edit/Visibility/By Item

Syntax: show “hidden object name”

Example: show “box1”

This example displays the object box1.ShowAll

Use: Shows all hidden objects.Command: Edit/Show All

Syntax: showall

Page 77: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

Generic Script Commands 4-15

ShowOrient

Use: Shows the object’s coordinate system.Command: none

Syntax: showorient “object name”

ShowRegion

Use: Shows the problem region.Command: Options/Region/Show

Syntax: showregion

ToggleRegion

Use: Toggles the visibility of the problem region.Command: none

Syntax: toggleregion

UnrotatedCS

Use: Switches to an unrotated coordinate system (that is parallel to the globalcoordinate system), preserving the origin.

Command: Coordinates/Unrotated CS

Syntax: unrotatedcs

VerifyRegion

Use: Verifies that region is correct.Command: Options/Region/Verify

Syntax: verifyregion

VisByItem

Use: Sets the visibility of individual objects. Select the items from the windowthat appears.

Command: Edit/Visibility/By Item

Syntax: visbyitem

XAxisAboutTo

Use: Rotates the local coordinate system’s x-axis about a vector so that thespecified point lies on a plane defined by the vector and the x-axis.

Command: Coordinates/Rotate X

Syntax: xaxisaboutto <vector to rotate about> [point to rotateto]

Example: xaxisaboutto zunitvec? [5,5,0]

This example rotates the local coordinate system’s x-axis about the unitvector on the z-axis so that the point [5,5,0] lies on the plane defined bythe unit vector and the x-axis.

Page 78: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

4-16 Generic Script Commands

XAxisTo

Use: Rotates the local coordinate system’s x-axis so that it goes through thegiven point.

Command: none

Syntax: xaxisto [point to rotate to]

Example: xaxisto [5,5,5]

This example rotates the x-axis until the point at [5,5,5] lies on it.XUnitVec?

Use: Creates a unit vector along the x-axis.Command: none

Syntax: xunitvec?

YAxisAboutTo

Use: Rotates the local coordinate system’s y-axis about a vector so that thespecified point lies on a plane defined by the vector and the y-axis.

Command: Coordinates/Rotate Y

Syntax: yaxisaboutto <vector to rotate about> [point to rotateto]

YAxisTo

Use: Moves the local coordinate system’s y-axis so that the specified point lieson the axis.

Command: none

Syntax: yaxisto [point to rotate to]

YUnitVec?

Use: Creates a unit vector along the y-axis.Command: none

Syntax: yunitvec?

ZAxisAboutTo

Use: Rotates the local coordinate system’s z-axis about a vector so that thespecified point lies on a plane defined by the vector and the z-axis.

Command: Coordinates/Rotate Z

Syntax: zaxisaboutto <vector to rotate about> [point to rotateto]

ZAxisTo

Use: Moves the local coordinate system’s z-axis so that the specified point lieson the axis.

Command: none

Syntax: zaxisto [point to rotate to]

Page 79: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3proj Script Commands

Generic Script Commands 4-17

ZUnitVec?

Use: Creates a unit vector along the z-axis.Command: none

Syntax: zunitvec?

Page 80: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3view Script Commands

4-18 Generic Script Commands

mod3view Script CommandsThe following script commands are classified as mod3view script commands.

AutoGrid

Use: Automatically sets the grid size to a specified number of pixels.Command: none

Syntax: autogrid GRID_DENSITY

Example: autogrid 20

This example places each grid point at 20 pixel intervals.FitAll

Use: Displays all objects in the geometric model in the active view window.Command: View/Fit All/Active View

Syntax: fitall

FitAllViews

Use: Displays all objects in the geometric model in all view windows.Command: View/Fit All/All Views

Syntax: fitallviews

FitSel

Use: Fits the selected objects into the current view window.Command: none

Syntax: fitsel

Lookat

Use: Defines the center point of the view window.Command: none

Syntax: lookat <vector>

Example: lookat <20,20,10>

This example moves the center of the view window to the new referencepoint [20,20,10].

Ortho

Use: Selects the orthogonal projection of the active view window. The greaterthe view width, the smaller the objects in the view window appear.

Command: none

Syntax: ortho view_width

Persp

Use: Selects the perspective projection.Command: none

Syntax: persp view_angle

Page 81: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3view Script Commands

Generic Script Commands 4-19

PolarGrid

Use: Displays a polar grid. Choose a radius large enough to be displayed inthe active window. Otherwise the grid will not be visible.

Command: none

Syntax: polargrid angle radius

Example: polargrid 10 10

This example displays a polar grid with grid points spaced every 10 unitsalong the radius and in 10 degree increments around the origin.

RectGrid

Use: Sets up a rectangular grid with the given spacing.Command: none

Syntax: rectgrid <xval, yval, zval>

Example: rectgrid <2,2,2>

This example displays a rectangular grid with grid points evenly spacedevery 2 units in each direction.

ResetViews

Use: Resets the 3D Modeler window to the four standard views.Command: View/Reset Standard Views

Syntax: resetviews

RotView

Use: Rotates the view in the active view window.Command: none

Syntax: rotview <vector to rotate about> angle

Example: rotview zunitvec? 45

This example rotates the view 45 degrees around the z unit vector.Shaded

Use: Shows the active view window in a flat or smooth shaded view.Command: View/Render/Flat Shaded and View/Render/Smooth Shaded

Syntax: shaded “flat/smooth”

Example: shaded “flat”

This example displays a flat shaded view of all the objects in the activeview window.

Page 82: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

mod3view Script Commands

4-20 Generic Script Commands

Viewpoint

Use: Defines a viewpoint.Command: none

Syntax: viewpoint <view point>

Example: viewpoint <0,0,0>

This example moves the viewpoint to the origin.Wireframe

Use: Sets the current view to wire frame mode.Command: View/Render/Wireframe

Syntax: wireframe

Page 83: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Script Commands 5-1

5

Executive Script Commands

This chapter describes the script commands specific to the Executive module.Refer to Appendix A, “Module Script Commands,” for a complete list of thecommands available in the Executive module.The Executive module uses the following command sets:● Generic module● mod3proj● mod3view● Default● HFSS● Emissions Setup● Solve SetupThe Generic module, mod3proj, mod3view, and Default command sets aredescribed in Chapter 3 and Chapter 4. This chapter describes the HFSS, Emis-sions Setup, and Solve Setup command sets.

Page 84: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

5-2 Executive Script Commands

HFSS Script CommandsThe following script commands are classified as HFSS script commands.

EmissionsSetup

Use: Launches the Setup Emission Test window.Command: Setup Executive Parameters/Emissions

Syntax: emissionssetup

LaunchBoundaries

Use: Launches the 3D Boundary Manager.Command: Setup Boundaries/Sources

Syntax: launchboundaries “view mode”

Note: view mode: ronly=read only, modify=allow modificationsLaunchImpedOnly

Use: Launches a restricted 3D Boundary Manager, allowing you to edit theport impedances.

Command: Setup Executive Parameters/Port Impedances

Syntax: launchimpedonly

Note: You can specify a “view mode” parameter (only modify is supported)with the LaunchImpedOnly command, but it is not necessary.

LaunchMaterials

Use: Launches the Material Manager.Command: Setup Materials

Syntax: launchmaterials “view mode”

Note: view mode: ronly=read only, modify=allow modificationsLaunchModeler

Use: Launches the 3D Modeler.Command: Draw

Syntax: launchmodeler “view mode”

Note: view mode: ronly=read only, modify=allow modificationsPostFields

Use: Launches the 3D Post Processor.Command: Post Process/Fields

Syntax: postfields

Page 85: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Script Commands 5-3

PostMatrixData

Use: Launches the Matrix Data Post Processor.Command: Post Process/Matrix Data

Syntax: postmatrixdata

PostMatrixPlot

Use: Launches the Matrix Plot Post Processor.Command: Post Process/Matrix Plot

Syntax: postmatrixplot

ProjDir

Use: Displays the directory for the current project.Command: none

Syntax: projdir

ProjName

Use: Displays the name of the current project.Command: none

Syntax: projname

SelectSolutionType

Use: Specifies the type of solution to generate either Driven Solution orEigenmode Solution.

Command: none

Syntax: selectsolutiontype “type”

Note: type: driven or eigenmodeExample: selectsolutiontype “eigenmode”

This example sets the solution type to eigenmode, instructing the soft-ware to use the Eigenmode solver to generate a solution.

SolveNominal

Use: Generates a solution.Command: Solve

Syntax: solvenominal

Page 86: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

5-4 Executive Script Commands

SolveSetup

Use: Launches the Solution Setup window.Command: Setup Solution

Syntax: solvesetup “visible”

Note: visible: 1=visible when launched, 0=not visible when launched.

☞Note: If you use the SolveSetup command, it must have its visibility set to 1

when you use macandexit. Refer to “Executing a Macro” on page 1-3 formore information about this command.

Page 87: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Script Commands 5-5

Emissions Setup Script CommandsThe following script commands are classified as Emissions Setup script com-mands.

EmissionsAddTest

Use: Adds an emission’s test setup to the list of setups.

Command: Add

Syntax: emissionsaddtest “name” radius surface phi_startphi_stop phi_points theta_z_start theta_z_stoptheta_z_points { “source1” “source2” ... }

Note: surface: 1=Sphere, 2=CylinderExample: emissionsaddtest “t1” 10 2 0 350 34 0 180 17

{“bound_2”}

This example adds an emissions test called t1 with the voltage sourcebound_2 to the list of test setups. This test has a radius of 10 on a cylindri-cal surface. The start, stop, and points values for phi are 0, 350, and 34respectively. The start, stop, and points values for z are 0, 180, and 17respectively.

EmissionsDeleteTest

Use: Deletes an emission test setup from the list of setups.Command: Delete

Syntax: emissionsdeletetest “name”

☞Note: You must use the SetupEditableEmParms command before you can add

new emissions tests.

Page 88: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

5-6 Executive Script Commands

EmissionsModifyTest

Use: Updates an emission test setup using new settings. This does not changethe calculated results of the tests that have been performed.

Command: Update

Syntax: emissionsmodifytest “name” “new name” radius surfacephi_start phi_stop phi_steps theta_z_starttheta_z_stop theta_z_steps { “source1” “source2” ... }

Note: surface: 1=Sphere, 2=CylinderExample: emissionsmodifytest “t1” “t2” 5 1 0 350 34 0 180 17

{“bound_2”}

This example modifies the emissions test t1, renaming it t2 and keepingthe voltage source bound_2. This test has a radius of 5 on a spherical sur-face. The start, stop, and points values for phi are 0, 350, and 34 respec-tively. The start, stop, and points values for theta are 0, 180, and 17respectively.

RollbackEditableEmParms

Use: Cancels the changes you have made to the emission setups after the lastsave and restores the setups from the last save.

Command: Cancel

Syntax: rollbackeditablesolveparms

SaveEditableEmParms

Use: Saves the emission test setups to a disk file used by Ansoft HFSS whengenerating a solution.

Command: none

Syntax: saveeditableemparms

SetupEditableEmParms

Use: Prepares the system to receive additions or changes to the emission testsetups. You must use this command before entering or changing theemission test setups.

Command: none

Syntax: setupeditableemparms

Page 89: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Script Commands 5-7

Solve Setup Script CommandsThe following script commands are classified as Solve Setup script com-mands.

ClearAllDifferentialPairs

Use: Clears all differential pair definitions.Command: none

Syntax: clearalldifferentialpairs

DefineDifferentialPair

Use: Defines a new differential pair.Command: none

Syntax: definedifferentialpair “name” “port” “positive”“negative”

Note: name: The name of the differential pair.port: The name of the port the pair is defined with. Both terminals mustbe part of the port.positive: The name of the positive terminal.negative: The name of the negative terminal.

ExitSolveSetup

Use: Exits the Setup Solution panel.Command: Exit

Syntax: exitsolvesetup

GetEigenFreq

Use: Returns the real and imaginary components of the resonant frequency forthe specified eigenmode solution and mode.

Command: none

Syntax: geteigenfreq “solution” mode

Note: solution: Enter the name of the solution.mode: 0=Mode 1, 1=Mode 2, etc.

Example: geteigenfreq “a_2” 0

This example returns the complex resonant frequency of the first mode ofthe second adaptive solution.

Page 90: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

5-8 Executive Script Commands

GetEigenLastSolnOfType

Use: Returns the name of the most recent solution of the specified type.Command: none

Syntax: geteigenlastsolnoftype “type”

Note: type: “adapt” or “non_adapt”GetEigenModeCount

Use: Returns the number of modes for the specified eigenmode solution.Command: none

Syntax: geteigenmodecount “solution”

GetEigenNumSolns

Use: Returns the number of completed adaptive, eigenmode solutions.Command: none

Syntax: geteigennumsolns

GetEigenSolnName

Use: Returns the name of the specified eigenmode solution.Command: none

Syntax: geteigensolnname soln_number

Note: soln_number: 0=First solution, 1=Second solution, etc.Example: geteigensolnname 0

This example returns the name of the first adaptive, eigenmode solutiongenerated, A_1. The first solution is called A_1, the second A_2, and soforth.

GetMinAdaptivePasses

Use: Returns the minimum number of adaptive passes.Command: none

Syntax: getminadaptivepasses

RollbackEditableSolveParms

Use: Cancels the changes you have made to the solution parameters after thelast save and restores the values from the last save.

Command: Cancel

Syntax: rollbackeditablesolveparms

SaveEditableSolveParms

Use: Saves the Setup Solution parameters.Command: none

Syntax: saveeditablesolveparms

Page 91: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Script Commands 5-9

SetAdaptiveInfo

Use: Sets the adaptive solution criteria.Command: Adaptive

Syntax: setadaptiveinfo passes “convergence type”tet_refinement

Note: passes: Enter the number of passes.convergence type: Enter one of the following.

tet_refinement: Enter the percentage for the Tet. Refinement.Example: setadaptiveinfo 3 “conv_delta” 30

This example defines an adaptive solution that stops when either 3 passesare complete or the maximum change in the S-parameters is the valuedefined with the SetConvDelta command. Thirty percent of the tetrahedraare refined during each pass. If you select Matrix Convergence as one ofyour stopping criteria, use the SetConvMatrix command to specify thestopping criteria for each S-parameter.

SetConvDelta

Use: Sets the value for the Max Delta S or Max Delta E stopping criterion.Command: Max Delta S or Max Delta E

Syntax: setconvdelta value

Type Solution Parameter

conv_delta Max Delta S or Max Delta E

conv_matrix Matrix Convergence

Page 92: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

5-10 Executive Script Commands

SetConvMatrix

Use: Sets the value for each S-parameter when you select the MatrixConvergence stopping criterion. Each entry specifies a required delta forthe corresponding S-parameter between successive passes.

Command: Matrix Convergence

Syntax: setconvmatrix “row portmode” “column portmode”magnitude phase

Note: phase: Enter the PHASE in degrees.Example: setconvmatrix “p1m1” “p1m1” 0.1 10

setconvmatrix “p1m1” “p2m1” 0.1 10setconvmatrix “p2m1” “p1m1” 0.1 10setconvmatrix “p2m1” “p2m1” 0.1 10

These define the magnitude and phase of each S-parameter in the S-matrix for a two-port device. Each port has a single mode.

SetEigenmodeInfo

Use: Specifies the solution parameters for an Eigenmode Solution.Command: Setup Solution

Syntax: seteigenmodeinfo max_modes min_freq adaptiveconv_delta num_passes tet_refinement

Note: max_modes: The number of modes to solve for. Limit of 20.min_freq: Minimum frequency at which to start, in hertz.adaptive: 0=Not selected, 1=Perform adaptive solutionconv_delta: The Maximum Delta Frequency percentage.num_passes: The number of adaptive passes to perform.tet_refinement: The percentage for the Tet. Refinement.

Example: seteigenmodeinfo 1 5000000000 1 10 3 20

This example selects Adaptive and sets the Maximum Number of Eigen-modes to 1, the Minimum Frequency to 5 GHz, the Maximum DeltaFrequency to 10, the Requested Passes to 3, and the Tet. Refinement to20 percent.

Page 93: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Script Commands 5-11

SetExplicitFreqs

Use: Explicitly specifies the frequencies for which the solver generates asolution. The frequency sweep must be a discrete sweep and the solvermust be set to Driven Solution. Only use this command if you want a non-uniform frequency distribution.

Command: none

Syntax: setexplicitfreqs num_freqs {frequency}

Note: num_freqs: The number of frequencies in the FREQUENCY list.frequency: The frequency, in hertz.

Example: setexplicitfreqs 3 {1000000000 2000000000 3000000000}

This example defines three frequency points at 1 GHz, 2 GHz, and 3 GHz.SetFrequency

Use: Specifies the Single Frequency for the problem. Enter the frequency inhertz.

Command: Single Frequency

Syntax: setfrequency frequency

SetFrequencyUnit

Use: Sets the unit of frequency to use for the problem.Command: Freq. Units

Syntax: setfrequencyunit “frequency unit”

Note: Use one of the following for Frequency unit:GHzMHzkHzHz

Page 94: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

5-12 Executive Script Commands

SetInitialMeshRefinement

Use: Specifies how Ansoft HFSS should refine the mesh when starting fromthe initial mesh. Refer to the Ansoft HFSS online documentation forfurther information on the two choices.

Command: Mesh Options

Syntax: setinitialmeshrefinement “refinement type”

Note: refinement type: Enter one of the following.

SetInterpolationInfo

Use: Sets the error tolerance and maximum number of solutions for aninterpolating frequency sweep.

Command: Sweep

Syntax: setinterpolationinfo error_tolerance max_solutions

Example: setinterpolationinfo 0.6 25

This example sets the Error Tolerance for the interpolating sweep to 0.6percent and the Maximum Solutions to 25.

Type Function

lambda Selects only lambda refining for theinitial mesh.

seeding Selects only seeding as the refine-ment type for the initial mesh. Youneed to specify the type of seedingusing the Meshmaker commands.

lambda_and_seeding Selects both lambda and seeding asthe refinement types for the initialmesh. You need to specify the type ofseeding using the Meshmaker com-mands.

none Selects neither lambda or seeding asthe refinement type.

Page 95: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Script Commands 5-13

SetMeshType

Use: Sets the starting mesh.Command: Starting Mesh

Syntax: setmeshtype “mesh type”

Note: Select from the following for Mesh type:initialcurrentpreviousmanual

Example: setmeshtype “initial”

This example sets the starting mesh to initial.SetMinAdaptivePasses

Use: Sets the minimum number of adaptive passes.Command: none

Syntax: setminadaptivepasses passes

Note: passes: number of minimum adaptive passes to complete during thesolution.

SetSolutionType

Use: Sets which solution types — Single Frequency, Adaptive, Frequency Sweep— to perform.

Command: none

Syntax: setsolutiontype single? adaptive? sweep? sweep_typeport_accuracy_percent

Note: single: 0=Not selected, 1=Perform single frequencyadaptive: 0=Not selected, 1=Perform adaptive solutionsweep: 0=Not selected, 1=Perform frequency sweepsweep_type: 0=Discrete sweep, 1=Fast sweep, 2=Interpolating sweep.

Example: setsolutiontype 1 1 1 0 2

This example instructs Ansoft HFSS to generate an adaptive solution at asingle frequency and to perform a discrete frequency sweep. The FieldAccuracy for a port solution is set to 2 percent.

Page 96: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

5-14 Executive Script Commands

SetSolverComputation

Use: Sets the solve type — All, Ports Only, Impedance Only, or Emissions Only— and the port solution specifications — Compute Modes and MaxModes.

Command: Solve and Port Solution

Syntax: setsolvercomputation “solve type” “which modes”max_modes

Note: solve type: one of the following:

which mode: one of the following:

max_modes: Enter the number of modes to calculate when N_modes isselected. Otherwise use 1.

Example: setsolvercomputation “all_fields” “all_modes” 1

This example generates a solution for all fields and all modes.

Type Function

all_fields Generates a solution for all parame-ters.

ports_only Computes the excitation field pat-terns, impedances, and propagationconstants at each port.

impedance_only Computes the port impedance only.

emissions_only Generates a solution only for theemissions test.

Mode Function

all_modes Computes and saves the field solu-tions associated with all modes at allports.

dominant_mode Computes and saves the field solu-tions associated with the dominantmode excitation at each port.

N_modes Computes and saves the solutionassociated with only the number ofmodes specified with MAX_MODES.

Page 97: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Script Commands 5-15

SetSweepInfo

Use: Sets the specifications of the frequency sweep.Command: Sweep

Syntax: setsweepinfo start_frequency stop_frequencynumber_of_steps

Note: Enter the frequency in hertz.Example: setsweepinfo 5000000000 10000000000 99

The sets the starting frequency for the frequency sweep to 5 GHz, thestopping frequency to 10 GHz, and the number of steps in the sweep at99.

SetupEditableSolveParms

Use: Enables you to define a set of editable solve parameters to use whendefining the solution options in the macro.

Command: none

Syntax: setupeditablesolveparms

Page 98: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

5-16 Executive Script Commands

Page 99: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-1

6

3D Modeler Script Commands

This chapter describes the script commands specific to the 3D Modeler mod-ule. Refer to Appendix A, “Module Script Commands,” for a complete list ofthe commands available in the 3D Modeler module.The 3D Modeler module uses the following command sets:● Generic module● mod3proj● mod3view● Default● Modeler3The Generic module, mod3proj, mod3view, and Default command sets aredescribed in Chapter 3 and Chapter 4. This chapter describes the Modeler3command set.

Page 100: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-2 3D Modeler Script Commands

Modeler3 Script CommandsThe following script commands are classified as Modeler3 script commands.

Box

Use: Draws a rectangular box.Command: Solids/Box

Syntax: box [base vertex] SIZEX SIZEY SIZEZ “object name”

Example: box [0,0,0] 20 40 20 “openbox”

This example creates a 20x40x20 box named openbox whose base vertex isat the origin. You cannot use variables for the base vertex using this syn-tax — use the Pos3 command instead.

Circle

Use: Creates a circle.Command: Lines/Circle

Syntax: circle [circle center] axis radius “object name”covered number_of_segments [facetted start position]

Note: axis: 0=X, 1=Y, 2=Zcovered: 0=No, 1=Yesnumber_of_segments: 0=True Surface

Example: circle [0,0,0] 2 20 “closecir” 1 8 [20,0,0]

This example creates a covered circle named closecir on the z-axis whoseradius is 20 from the origin. The circle is made from eight line segmentsthat start at the point [20,0,0].

Close3d

Use: Closes the current active window.Command: File/Close

Syntax: close3d

ColorFaces

Use: Changes the color of selected faces.Command: none

Syntax: colorfaces

ColorSel

Use: Changes the color of all selected objects to the current default color.Command: Edit/Attributes/Recolor

Syntax: colorsel

Page 101: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-3

Connect

Use: Connects multiple profiles or faces to form a surface.Command: Surfaces/Connect

Syntax: connect “profile1” “profile2”

Example: connect “pline1” “pline3”

This example creates a new surface from the polylines Pline1 and Pline3.CoverOutl

Use: Covers closed polylines with faces to make sheet objects.Command: Surfaces/Cover Lines

Syntax: coveroutl {“polyline1” “polyline2”...}

CoverSheets

Use: Covers all open edges of sheet objects to create solids.Command: Solids/Cover Sheets

Syntax: coversheets {“sheet1” “sheet2”...}

CreateArc

Use: Draws an arc.Command: Lines/Arc

Syntax: createarc [base center] arc_axis radius height [radiusvector] [clockwise? y/n] [angle or end position]number_of_segments “object name”

Note: arc_axis: 0=X, 1=Y, 2=Znumber_of_segments: 0=True Surface

Example: createarc [0,0,0] 2 20 50 [10,10,20] y [20,20,25] 12“arc1”

This example creates a clockwise arc made up of 12 segments named arc1that begins at [10,10,20] and ends at [20,20,25].

Page 102: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-4 3D Modeler Script Commands

Cyl

Use: Draws a cylinder.Command: Solids/Cylinder

Syntax: cyl [base center] axis radius height “object name”number_of_segments [facetting start position]

Note: axis: 0=X, 1=Y, 2=Znumber_of_segments: 0=True Surface

Example: cyl [0,0,0] 2 20 50 “coppercyl” 8 [20,0,10]

This example creates a cylinder named coppercyl with a base centered atthe origin, oriented along the z-axis (axis = 2), that has a radius of 20 anda height of 50. The cylinder is made up of eight segments (or facets). Thefacetting starts at [20,0,10], an arbitrary point on the curved surface of thecylinder.

DefColor

Use: Defines the default color for new objects.Command: Edit/Attributes/Recolor

Syntax: defcolor redvalue greenvalue bluevalue

Note: redvalue: 0-255greenvalue: 0-255bluevalue: 0-255

Example: defcolor 0 0 140

This example makes the default color pale blue.DefColor?

Use: Displays the default object color.Command: none

Syntax: defcolor?

Delete

Use: Deletes the specified object or objects. You may use wildcards in theobject name to delete multiple objects.

Command: none

Syntax: delete “object name”

Page 103: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-5

DeSelect

Use: Deselects the specified object or objects. You may use wildcards in theobject name to delete multiple objects.

Command: Edit/Deselect All or Select from the right mouse button menuSyntax: deselect “object name”

Example: deselect *

This example deselects all objects.DetachFaces

Use: Detaches faces from objects.Command: Surfaces/Detach Faces

Syntax: detachfaces “face1” “face2” ... “facen”

Example: detachfaces “topside” “leftface”

This detaches faces topside and leftface from their respective objects.DisablePlineStitch

Use: Disables stitching of polylines, so that polylines are not stitched togetheras they are created. Polyline stitching is enabled by default. UseEnablePlineStitch to enable the stitching of polylines.

Command: none

Syntax: disableplinestitch

DupAxis

Use: Copies selected objects around the current view axis.Command: Edit/Duplicate/Around Axis

Syntax: dupaxis axis angle total_number

Note: axis: 0=X, 1=Y, 2=ZExample: dupaxis 0 90 2

This example duplicates the selected objects 90 degrees around the x-axis.The number of objects after the duplication is two (this includes the origi-nal).

DupLine

Use: Copies the selected objects along a line.Command: Edit/Duplicate/Along Line

Syntax: dupline vector total_number

Example: dupline <0,20,0> 2

This example creates a duplicate of the selected objects a distance of 20units along the y-axis. The number of objects after the duplication is two(this includes the original).

Page 104: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-6 3D Modeler Script Commands

DupMirror

Use: Copies the selected objects by mirroring them across the selected plane.Command: Edit/Duplicate/Mirror

Syntax: dupmirror [point on mirror plane] [point normal tomirror plane]

Example: dupmirror [0,0,0] [0,10,0]

This example creates a duplicate of the selected objects about the xzplane.

EditPline

Use: Creates or edits a planar or 3D polyline.Command: Lines/Polyline

Syntax: editpline “polyline/sheet object”

Example: editpline “line1”

This example creates (or edits, if a line already exists with that name) apolyline named Line1. You then enter Edit Pline mode, and will need touse the EditPline script commands to create the polyline.

EditPline - AddVert

Use: Adds a vertex to the polyline.Command: Lines/Polyline

Syntax: addvert [x,y,z]

Example: addvert [0,0,0]

This example adds a vertex at the origin.EditPline - AddVert3D

Use: Adds a vertex to the polyline.Command: Lines/Polyline

Syntax: addvert3d x y z

Example: addvert3d 0 0 0

This example adds a vertex at the origin.

EditPline - Arc

Use: Creates an arc.Command: Lines/Polyline

Syntax: arc angle

Example: arc 45

This example creates an arc of 45 degrees on the end of the polyline.

Page 105: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-7

EditPline - CancelPline

Use: Exits polyline or sheet edit modeCommand: Lines/Polyline

Syntax: cancelpline

EditPline - ClosePline

Use: Connects the last vertex entered with the first vertex entered, creating aclosed loop.

Command: Lines/Polyline

Syntax: closepline

EditPline - DelEdge

Use: Deletes an edge of the polyline.Command: Lines/Polyline

Syntax: deledge edge_number

Example: deledge 0

This example deletes the first line segment created. The line segmentnumbering begins at 0 with the first segment created. When you delete anedge, the segments created after that edge are renumbered.

EditPline - DelVert

Use: Deletes the specified vertex.Command: Lines/Polyline

Syntax: delvert [x,y,z]

Example: delvert [0,0,0]

This example deletes the vertex at the origin.EditPline - EdgeGeom

Use: Changes the Edge Geometry of a segment.Command: Lines/Polyline

Syntax: edgegeom edge_number edge_geometry

Note: edgegeometry: 0=Straight, 1=Arc, 2=SplineExample: edgegeom 1 1

This example changes the second line segment to an arc segment. The linesegment numbering begins at 0 with the first segment created.

Page 106: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-8 3D Modeler Script Commands

EditPline - EdgeMode

Use: Specifies the Edge Geometry mode.Command: Lines/Polyline

Syntax: edgemode edge_geometry

Note: edgegeometry: 0=Straight, 1=Arc, 2=SplineExample: edgemode 1

This example specifies the Edge Geometry mode as Arc. All segments cre-ated after this will be arc segments.

EditPline - EndPline

Use: Use this when you have finished creating or editing the polyline and youwish to save it.

Command: Lines/Polyline

Syntax: endpline cover?

Note: cover: 0 for no, 1 for yes.Example: endpline 1

This example ends and covers the polyline to form a sheet object.EditPline - EndTangent

Use: Makes an edge of the arc end tangent to the next edge.Command: Lines/Polyline

Syntax: endtangent edge_number

Example: endtangent 2

This example makes the edge of the arc (edge number 1) end tangent tothe next edge (edge number 2).

EditPline - FindPlineVertNo

Use: Finds the vertex number for a vertex at the specified position.Command: Lines/Polyline

Syntax: findplinevertno [x,y,z]

Example: findplinevertno [2,4,0]

This example finds the vertex number of the vertex at [2,4,0].EditPline - GetPlineVert

Use: The opposite of findplinevertno. This finds the position of the specifiedvertex number.

Command: Lines/Polyline

Syntax: getplinevert vertex_number

Example: getplinevert 3

This example returns the position of the third vertex.

Page 107: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-9

EditPline - Insvert

Use: Inserts a vertex in the middle of a polyline.Command: Lines/Polyline

Syntax: insvert [vertex to insert before] [new position]

Example: insvert [2,4,0] [2,2,0]

This example inserts a new vertex at [2,2,0], before the vertex at [2,4,0].EditPline - JoinSplines

Use: Joins two splines that share a vertex.Command: Lines/Polyline

Syntax: joinsplines vertex_number

Example: joinsplines 3

This example joins the two polylines that share the third vertex.EditPline - MoveArcMidPt

Use: Moves the midpoint of an arc.Command: Lines/Polyline

Syntax: movearcmidpt edge_number [x,y,z]

Example: movearcmidpt 1 [2,2,0]

This example moves the midpoint of the arc (edge number 1) to [2,2,0].EditPline - MoveVert

Use: Moves a vertex to the specify position.Command: Lines/Polyline

Syntax: movevert [vertex position] [new position]

Example: movevert [2,4,0] [2,2,0]

This example moves the vertex at [2,4,0] to [2,2,0].EditPline - OpenPline

Use: The opposite of closepline. This creates an opening in a closed polyline byremoving the segment that closed the loop.

Command: Lines/Polyline

Syntax: openpline

EditPline - SetArcAngle

Use: Sets the angle of a polyline arc.Command: Lines/Polyline

Syntax: setarcangle edge_number angle

Example: setarcangle 1 60

This example sets the angle of the arc (edge number 1) to 60 degrees.

Page 108: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-10 3D Modeler Script Commands

EditPline - SetArcRadius

Use: Sets the radius of a polyline arc.Command: Lines/Polyline

Syntax: setarcradius edge_number radius

Example: setarcradius 1 10

This example sets the radius of the arc (edge number 1) to 10. The units ofthe radius are the units you specified in the 3D Modeler.

EditPline - SetArcToFillet

Use: Sets the radius of the polyline arc to a fillet with the given radius.Command: Lines/Polyline

Syntax: setarctofillet edge_number radius

Example: setarctofillet 1 10

This example sets the radius of the arc (edge number 1) to 10 and selectsFillet.

EditPline - SplitSpline

Use: Splits a spline in two at the specified vertex.Command: Lines/Polyline

Syntax: splitspline vertex_number

Example: splitspline 3

This example splits the splines at the third vertex.EditPline - StartTangent

Use: Makes an edge of the arc start tangent to the previous edge.Command: Lines/Polyline

Syntax: starttangent edge_number

Example: starttangent 2

This example makes the edge of the arc (edge number 1) start tangent tothe previous edge (edge number 0).

EnablePlineStitch

Use: Enables stitch mode for polylines so that polylines are stitched together asthey are created. Polyline stitching is enabled by default. UseDisablePlineStitch to disable stitching for polylines.

Command: none

Syntax: enableplinestitch

Page 109: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-11

Exit

Use: Exits the current module.Command: File/Exit

Syntax: exit

ExpAssign

Use: Assigns an expression to a variable. The variable and its related definitionare used in the Symbol Table.

Command: Options/Expressions

Syntax: expassign “variable name” expression

Example: expassign “x” xcomponent my_vector

This example assigns the x component of my_vector to the variable x.

ExpClear

Use: Clears all entries in the Symbol Table.Command: none

Syntax: expclear

ExpDel

Use: Deletes the specified variable from the Symbol Table.Command: Options/Expressions

Syntax: expdel “variable name”

ExpEval

Use: Evaluates the expression specified from the Symbol Table.Command: none

Syntax: expeval “expression name”

Example: expeval “t=5+x”

This example calculates the value for t based on the variable x.ExpInc

Use: Increments an evaluator variable by a specified value.Command: none

Syntax: expinc “expression” increment_value

Example: expinc “t” 2

This example increments the defined expression t by two. The expressionmust be a previously defined variable.

☞Note: This script command is unlike the script command assign. The variable

defined here is used by the software itself, whereas the variable definedwith assign is used by the scripting language.

Page 110: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-12 3D Modeler Script Commands

ExpLoad

Use: Loads expressions from a file into the Symbol Table.Command: none

Syntax: expload “file name”

Example: expload “expvar”

This example loads the expressions in expvar into the Symbol Table.ExpSave

Use: Saves expressions and variables in the Symbol Table to a file.Command: none

Syntax: expsave “file name”

Example: expsave “expvar”

This example saves the Symbol Table to the file expvar.FitRegion

Use: Fits the entire modeling region in the view window.Command: Options/Region/Fit All

Syntax: fitregion padding_percent “roundoff y/n?”

Note: roundoff: yes=selected, no=deselectedExample: fitregion 20 “y”

This example fits the region in the active window with 20% empty spacebetween the edge of the region and the edge of the active view window.

FitSel

Use: Fits selected items in the current view window.Command: View/Fit Selection

Syntax: fitsel

HealAllObjects

Use: Automatically corrects geometric errors in the model.Command: none

Syntax: healallobjects

Page 111: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-13

Helix

Use: Draws a helix.Command: Solids/Helix

Syntax: helix “polyline” axis pitch number_of_turnsnumber_of_segments radius_change “object name”

Note: axis: The axis of the helix. 0=X, 1=Y, 2=Zpitch: The end-to-end distance of the helix.radius_change: The change in the radius for each turn.

Example: helix “pline1” 0 20 3 12 5 “helix1”

This example creates a three-turn helix about the x-axis called helix1 fromthe object pline1. The helix has a pitch of 20, 12 segments per turn, and theradius increases by 5 per turn.

HideRegion

Use: Hides the problem region.Command: Edit/Visibility/Toggle Region

Syntax: hideregion

Import3D

Use: Loads a 3D model or ACIS file (.sm3 or .sat) into the current project.Command: File/Import/3D Modeler/ACIS File

Syntax: import3d /directory/filename

Example: import3d /draw/eddycur.sm3

This example imports the file eddycur.sm3 into the current file.Intersect

Use: Creates an object by taking the intersecting parts of two or more objects.Command: Solids/Intersect

Syntax: intersect {“object1” “object2” “objectx”}

LaunchScaleDialog

Use: Accesses the Scale Factors window to redefine object scaling.Command: none

Syntax: launchscaledialog

Mirror

Use: Mirrors the selected objects across the selected plane.Command: Arrange/Mirror

Syntax: mirror [point on mirror plane] [point normal to mirrorplane]

Example: mirror [0,0,0] [0,10,0]

This example mirrors the selected objects about the xz plane.

Page 112: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-14 3D Modeler Script Commands

Move

Use: Moves the selected objects the distance (length) and direction of thespecified vector.

Command: Arrange/Move

Syntax: move vector

Example: move <0,20,0>

This example moves the selected objects a distance of 20 units along they-axis.

New3d

Use: Creates a new 3D Modeler project.Command: File/New

Syntax: new3d “unit name”

Example: new3d “meters”

This example creates a new project with units of meters.PmlCoverSetup

Use: Runs the macro that assists you in drawing PML objects. You have theoption of specifying the starting point when you enter this command.

Command: none

Syntax: pmlcoversetup [starting point]

Note: The starting point is optional.Point

Use: Creates a 3D point object.Command: Lines/Point

Syntax: point [position] “point name”

Example: point [5,5,0] “point1”

This example creates a point called point1 at [5,5,0].

☞Note: If you enter any PML command in the Command Prompt area while you

are recording a macro, the PML command itself is not recorded. Instead,the commands that compose the PML command, and your input into thePML macro, are recorded. You can then re-run the recorded macro.

However, if you attempt to use a PML command directly in a macro, itwill fail.

Page 113: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-15

ProjPrefs

Use: Sets preferences for new projects.Command: Options/Project Preferences

Syntax: projprefs

Read2d

Use: Reads in objects from a 2D model file (.sm2).Command: File/Import/2D Modeler File

Syntax: read2d “file name” “polygon approximation?”

Note: polygon approximation: y=selected, n=deselectedExample: read2d “box.sm2” “y”

This example reads in the objects from the file box.sm2 and converts theobjects into a polygon approximation, such as a sheet objects or polylines.

Read3d

Use: Opens a 3D modeler project (.sm3).Command: File/Open

Syntax: read3d “file name”

Recolor

Use: Changes the color of an object to a newly defined color.Command: none

Syntax: recolor “object name” redvalue greenvalue bluevalue

Note: redvalue: 0-255greenvalue: 0-255bluevalue: 0-255

Example: recolor “box1” 255 0 0

This example changes the color of the object box1 to red.

Page 114: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-16 3D Modeler Script Commands

Rectangle

Use: Creates a rectangle.Command: Lines/Rectangle

Syntax: rectangle [first point] normal width height “objectname” covered

Note: normal: The axis normal to the rectangle. (0=X, 1=Y, 2=Z)width: The width along the lower numbered axis.height: The height along the higher numbered axis.covered: 0=uncovered, 1=covered

Example: rectangle [0,0,0] 0 10 20 “rect1” 1

This example creates a 10x20 rectangle, rect1, whose base vertex is at theorigin and is normal to the x-axis. This rectangle is covered, meaning it isconsidered a sheet object.

Redo

Use: Repeats previous commands undone by the Undo or Edit/Undocommand.

Command: Edit/Undo

Syntax: redo number_steps

Example: redo 1

This example repeats the last action affected by the Undo command.Region

Use: Defines the problem region.Command: Options/Region/Define

Syntax: region [first vertex] size_x size_y size_z

Example: region [0,0,0] 200 200 200

This example defines the region as a 200x200x200 cube whose base vertexis at [0, 0, 0].

Rename

Use: Renames an object.Command: Edit/Attributes/By Clicking

Syntax: rename “old name” “new name”

Page 115: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-17

ResetViews

Use: Resets the view windows to the four standard views.Command: View/Reset Standard Views

Syntax: resetviews

Note: The standard views in the 3D Modeler are 4 windows, with the globalcoordinate system, unzoomed and unrotated. The views are parallel witheach plane, plus one xyz view.

Rotate

Use: Rotates the selected objects around an axis.Command: Arrange/Rotate

Syntax: rotate axis angle

Note: axis: 0=X, 1=Y, 2=ZExample: rotate 0 90

This example rotates the selected objects 90 degrees around the x-axis.Save2d

Use: Saves the xy plane of the model to a 2D Modeler (.sm2) file.Command: File/Export/2D Modeler File

Syntax: save2d “file name”

Save3d

Use: Saves the current model.Command: File/Save As

Syntax: save3d “file name” “format”

Note: format: b=binary, a=ASCIISaveSAT

Use: Saves the model to the specified version of an ACIS (.sat) file.Command: File/Save As

Syntax: savesat “file name” [format] major_version minor_version

Note: format: bin or ASCIIExample: savesat “model1” bin 1 7

This example saves the file model1.sat as an ACIS 1.7 file.SaveSLD

Use: Saves the model in .sld format.Command: File/Export/Old 3D Modeler

Syntax: savesld “file name”

Page 116: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-18 3D Modeler Script Commands

Scale

Use: Changes the scale of an object’s dimensions.Command: Arrange/Scale

Syntax: scale scale_factor

Example: scale 2

This example scales the object so that it is twice as large.Section

Use: Generates sheet objects from cross-sections of objects.Command: Surfaces/Section

Syntax: section normal {“object1” “object2” ...}

Note: normal: Section plane normal to. 0=X,1=Y,2=ZExample: section 1 “box1”

This example created a 2D object from a cross-section of box1. The y-axisis normal to the plane of the new 2D object.

SelClear

Use: Clears the selected objects.Command: Edit/Clear

Syntax: selclear

SelColor

Use: Changes the selection highlight color.Command: Options/Selection Color

Syntax: selcolor redvalue greenvalue bluevalue

Note: redvalue: 0-255, greenvalue: 0-255, bluevalue: 0-255SelCopy

Use: Copies the selected objects to the clipboard.Command: Edit/Copy

Syntax: selcopy

SelCut

Use: Cuts the selected objects and saves them to the clipboard for futurepasting.

Command: Edit/Cut

Syntax: selcut

SelFaces

Use: Copies the selected objects to the clipboard.Command: Edit/Copy

Syntax: selfaces

Page 117: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-19

SelPaste

Use: Pastes objects from the clipboard to the current project.Command: Edit/Paste

Syntax: selpaste

SetModel

Use: Includes an object into the model to solve.Command: Edit/Attributes/By Clicking

Syntax: setmodel “object name”

SetNonModel

Use: Excludes an object from the model solution.Command: Edit/Attributes/By Clicking

Syntax: setnonmodel “object name”

SetSldTol

Use: Sets the tolerance parameters for translation into .sld format.Command: none

Syntax: setsld distance_tol normal_tol

Example: setsld 1e-3 1e-4

This sets the model tolerance to 10-3 for the distance tolerance and to 10-4

for the standard tolerance in the .sld translation.SetUnits

Use: Defines and sets current units relative to meters.Command: Options/Units

Syntax: setunits “unit name” “rescale? (y/n)”

Example: setunits “mm” “y”

This example defines the new units as mm and rescales the model to thenew units.

ShowRegion

Use: Displays the problem region.Command: Edit/Visibility/Toggle Region

Syntax: showregion

Note: Make the region invisible with HideRegion.

Page 118: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-20 3D Modeler Script Commands

Split

Use: Splits an object into sections.Command: Solids/Split

Syntax: split plane_normal fragments_to_keep “object name”

Note: plane_normal: 0=X, 1=Y, 2=Zfragments_to_keep: 0=above, 1=below, 2=both

Example: split 2 1 “box1”

This example splits the object box1 into two sections, keeping the frag-ments below the split plane.

Stitch

Use: Stitches selected surfaces among common edges.Command: Surfaces/Stitch

Syntax: stitch {“sheet1” “sheet2” sheetx”}

Example: stitch {“sheet1” “pline1” “redsheet”}

This example stitches the sheet objects Sheet1, Pline1, and Redsheet into asingle surface.

Subtract

Use: Subtracts overlapping objects to form a single non-overlapping object.Command: Solids/Subtract

Syntax: subtract “first object name” “second object name”

Example: subtract “cyl1” “box1”

This example subtracts the object cyl1 from box2.SweepAxis

Use: Sweeps a face, profile, or polyline around the view axis to create 3Dsolids.

Command: Solids/Sweep/Around Axis

Syntax: sweepaxis {“profile to sweep”} axis sweep_angle stepsdraft_angle draft_type

Note: axis: 0=X, 1=Y, 2=Zsweep_angle: Angle to sweep through. (-360 to 360)steps: Number of segments to sweep through. (0=circular)draft_type: 0=extended, 1=round

Example: sweepaxis “rect1” 2 60 0 10 0

This example sweeps the object rect1 60 degrees about the z-axis in asmooth, circular manner. The profile expands by 10 degrees as it is sweptand maintains its sharp corners as it does so.

Page 119: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands 6-21

SweepPath

Use: Sweeps a closed profile along a polyline path to create 3D solid.Command: Solids/Sweep/Along Path

Syntax: sweeppath {“profiles to sweep”} “sweep path polyline”draft_angle draft_type

Note: draft_type: 0=extended, 1=roundExample: sweeppath “blueface” “pline1” 10 0

This example sweeps the object blueface along the polyline pline1,expanding by 10 degrees as it does so. The object retains its sharp cornersas it is swept.

SweepTwist

Use: Sweeps a closed profile along a polyline path with a twist.Command: Solids/Sweep/Along Path with Twist

Example: sweeptwist “blueface” “pline1” 20

This example sweeps the object blueface along the polyline pline1 whiletwisting the object by 20 degrees.

SweepVec

Use: Sweeps a closed profile along a vector to create a new 3D solid.Command: Solids/Sweep/Along Vector

Syntax: sweepvec {“closed polyline”} <vector>

Uncover

Use: Uncovers the selected faces of objects.Command: Surfaces/Uncover Faces

Syntax: uncover “face name”

Example: uncover “rect1:0”

This example uncovers the face named rect1:0 on the sheet object rect1.Undel

Use: Undeletes previously deleted (cleared) objects.Command: Edit/Undelete

Syntax: undel number_of_objects

Example: undel 2

This example undeletes the last two objects that were deleted.Undo

Use: Undo the previous operations.Command: Edit/Undo

Syntax: undo number_of_steps

Page 120: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

6-22 3D Modeler Script Commands

Unite

Use: Adds (unites) 3D objects.Command: Solids/Unite

Syntax: unite {“object1” “object2” “objectx”}

Page 121: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Material Manager Script Commands 7-1

7

Material Manager Script Commands

This chapter describes the script commands specific to the Material Managermodule. Refer to Appendix A, “Module Script Commands,” for a completelist of the commands available in the Material Manager module.The Material Manager module uses the following command sets:● Generic module● mod3proj● mod3view● Default● Materials● MaterialKernelThe Generic module, mod3proj, mod3view, and Default command sets aredescribed in Chapter 3 and Chapter 4. This chapter describes the Materialsand MaterialKernel command sets.

Page 122: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

7-2 Material Manager Script Commands

Materials Script CommandsThe following commands are classified as a Materials commands.

EditBHCurve

Use: Displays the BH-Curve Entry window, allowing you to create or modifyBH-curves.

Command: BH-Curve

Syntax: editbhcurve

PMLMatSetup

Use: Runs the macro that assists you in calculating and entering the materialmatrices of PML objects. The objects can be drawn by either the user or bythe software.

Command: none

Syntax: pmlmatsetup

☞Note: If you enter any PML command in the command prompt while you are

recording a macro, the PML command itself is not recorded. Instead, thecommands that compose the PML command, and your input into thePML macro, are recorded. You can then re-run the recorded macro.

Because the PML commands activate interface windows, they are notappropriate for use in macros. If you attempt to use a PML commanddirectly in a macro, it will fail.

Page 123: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Material Manager Script Commands 7-3

MaterialKernel Script CommandsThe following script commands are classified as MaterialKernel commands.

GetSelectedMaterial

Use: Returns the name of the currently selected material.Command: none

Syntax: getselectedmaterial

MaterialAccept

Use: Saves the changes to the selected material and assigns it a name.Command: none

Syntax: materialaccept “material name”

MaterialAdd

Use: Adds a material to the database. The material is derived from the mate-rial, vacuum. Use the MaterialSetProperty and MaterialSetType com-mands to define the material. Use the MaterialAccept command to savethe material.

Command: Material/Add

Syntax: materialadd

MaterialAssign

Use: Assign a selected material to one or more objects. Select the material firstwith the MaterialSelect command.

Command: Assign

Syntax: materialassign {“object1” “object2” ...} “coordinatesystem” {“about x” “about y” “about z”} {“x” “y” “z”}

Note: coordinate system: ocs=object CS, abs=absolute CS

Example: materialassign“stuff1”“ocs”{“0.0”“0.0”“0.0”{“0.0”“0.0”“0.0”}

This example assigns the selected material to the object stuff1. The anglesand coordinates are both set to zero. Set the coordinate system to ocs andthe angles and coordinates to zero if you are assigning an isotropic, non-linear, or perfectly conducting material to an object.

☞Note: Use ocs to select either Align material with object’s orientation or Align mate-

rial relative to object’s orientation when assigning an anisotropic material toan object. If you are using ocs to select Align material with object’s orienta-tion, set the angles (About X, About Y, and About Z) and coordinates (X, Y,Z) to zero.

Use abs to select Align material with a given direction. For further informa-tion on assigning materials with anisotropic properties, refer to the onlinedocumentation.

Page 124: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

7-4 Material Manager Script Commands

MaterialClear

Use: Removes the selected material from the local material database. Select thematerial first with the MaterialSelect command.

Command: Material/Clear

Syntax: materialclear

Example: materialselect “testmat” materialclear

This example selects the material testmat and deletes it.MaterialDerive

Use: Adds a new material with the material properties of the currentlyselected material to the local material database. Use the MaterialSetProp-erty and MaterialSetType commands to define the material. Use the Mate-rialAccept command to save the material.

Command: Material/Derive

Syntax: materialderive “new material”

MaterialModifyFunction

Use: Adds, updates, or deletes a function.Command: Functions

Syntax: materialmodifyfunction operation “function name”“function expression”

Note: operation: 0=add/update, 1=deleteExample: materialmodifyfunction 0 “mat1” “x+5”

This example adds the new function Mat1 and defines it as X+5.MaterialPMLSetup

Use: Defines a perfectly matched layer.Command: none

Syntax: materialpmlsetup “object source” “contact materialtype” “termination type” minimum_frequency_or_betamaximum_frequency_or_beta mimimum_radiating_distancelayer_thickness “propagating orientation”contact_permittivity contact_permeability {pml objectlist}

Note: pml object list: a string list of PML objects.Example: materialpmlsetup “core” “ferrite” “end” 6000000

8000000 .05 .01 “z” 0.00323 0.1239 {“sheet” “layer1”}

This example defines sheet and layer1 as PMLs that have ferrite contactsand whose system operates between 6 and 8 MHz.

Page 125: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Material Manager Script Commands 7-5

MaterialRevert

Use: Deletes any changes for the selected material and reverts back to thematerial’s original properties. If the original material properties dependon functions that have been deleted, any references to that function willnot be updated.

Command: Revert

Syntax: materialrevert

MaterialSelect

Use: Selects a material.Command: none

Syntax: materialselect “material name”

Example: materialselect “ndfe35”

This example selects the material NdFe35.

Page 126: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

7-6 Material Manager Script Commands

MaterialSetProperty

Use: Defines the specified material properties for the selected material. Aftersetting the material property, be sure to use the MaterialAccept commandto save your changes.

Command: none

Syntax: materialsetproperty “property” vecfunc {“value”}

Note: “property” must be one of the following:conductivity or sigmapermittivity or epsimag_permittivity or eps2elec_losstanpermeability or muimag_permeability or mu2mag_losstanperm_magnetization or Mpperm_polarization or Ppmag_coercivity or Hcmag_retentivity or Brelec_coercivity or Ecelec_retentiviy or Drsaturation_maglande_gdelta_h

VECFUNC: Not used in HFSS. Set to 0.

Example: materialsetproperty “permittivity” 0 {“9.6e+00”}

This example sets the material property permittivity to a value of 9.6.MaterialSetType

Use: Specify the type of material — isotropic, anisotropic, nonlinear, or perfectconductor.

Command: none

Syntax: materialsettype “material type”

Example: materialsettype “anisotropic”

This example sets the material type to anisotropic for the selected mate-rial.

☞Note: If you are defining an anisotropic material, the “value” string list should

correspond to the diagonal values in the associated material propertymatrix, {“diag1” “diag2” “diag3”}. For other material types, thevalue of the material property is all that is required.

Page 127: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Material Manager Script Commands 7-7

MaterialUnderive

Use: Underives the selected, derived material. Changes made to an originalmaterial are reflected in any material derived from the original. There-fore, if you do not wish to change the derived materials when you changethe original, underive the derived materials before making any changes.

Command: Material/Underive

Syntax: materialunderive

Example: materialselect “material88” materialunderive

This example selects the material Material88 and disassociates it from thematerial it was derived from.

ObjectSetSolveInside

Use: Specify whether or not to generate a solution inside the object.Command: Solve Inside and Solve Surface

Syntax: objectsetsolveinside { “object1” “object2” } “yes/no”

Example: objectsetsolveinside “box1” “yes”

This example instructs the software to generate a solution inside theobject box1.

SaveMaterialDatabase

Use: Saves the local material database.Command: none

Syntax: savematerialdatabase “warning”

Note: warning: warn=don’t save if there are inconsistenciesnowarn=save despite inconsistencies

Example: savematerialdatabase “warn”

This example saves the local material database. If there are inconsisten-cies or problems in the material setup, the save will not be done becausethe warning setting was set to warn.

Page 128: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

7-8 Material Manager Script Commands

Page 129: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Boundary Manager Script Commands 8-1

8

Boundary Manager Script Commands

This chapter describes the script commands specific to the Boundary Man-ager module. Refer to Appendix A, “Module Script Commands,” for a com-plete list of the commands available in the Boundary Manager module.The Boundary Manager module uses the following command sets:● Generic module● mod3proj● mod3view● Default● Boundary module● Boundary KernelThe Generic module, mod3proj, mod3view, and Default command sets aredescribed in Chapter 3 and Chapter 4. This chapter describes the Boundarymodule and Boundary Kernel command sets.

Page 130: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

8-2 Boundary Manager Script Commands

Boundary Module Script CommandsThe following script commands are classified as Boundary Module script com-mands.

DefineBndFuncs

Use: Displays the Symbol Table allowing you to define functions to be usedwith the 3D Boundary Manager.

Command: Model/Functions

Syntax: definebndfuncs

ExitBoundaries

Use: Exits the Boundary Manager.Command: File/Exit

Syntax: exitboundaries

SaveBoundaries

Use: Saves the boundary settings.Command: File/Save

Syntax: saveboundaries

SelectByName

Use: Accesses the Select By Name window.Command: Edit/Select/By Name

Syntax: selectbyname

SelectFacesIntersection

Use: Accesses the Select faces intersection window.Command: Edit/Select/Faces Intersection

Syntax: selectfacesintersection

SetDefaultUnits

Use: Accesses the Select Unit Preferences window.Command: Model/Units

Syntax: setdefaultunits

ToggleViewBndVis

Use: Toggles the boundary visualization of the active window.Command: View/Toggle Boundary Visualization

Syntax: toggleviewbndvis

Page 131: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Boundary Manager Script Commands 8-3

Boundary Kernel Script CommandsThe following script commands are classified as Boundary Kernel script com-mands.

BoundaryModifyFunction

Use: Adds, updates, or deletes a function.Command: Functions

Syntax: boundarymodifyfunction operation “function name”“function expression”

Note: operation: 0=add/update, 1=deleteExample: boundarymodifyfunction 0 “Mat1” “X+5”

This example adds the new function Mat1 and defines it as X+5.ClearAllBnds

Use: Clears all boundaries in the model.Command: none

Syntax: clearallbnds

ClearSelection

Use: Deselects the selected objects.Command: none

Syntax: clearselection

NeedCalibLine

Use: Toggles the calibration line on or off for the specified port modes of theport you are currently defining.

Command: Port

Syntax: needcalibline mode toggle

Note: toggle: 0=no (off), 1=yes (on)Example: needcalibline 2 1

This example instructs the system to use a calibration line for the secondmode of the port you are defining. You still need to use the setcalibline-start and setcaliblineend commands to specify the calibration line itself.

Page 132: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

8-4 Boundary Manager Script Commands

NeedImpedLine

Use: Toggles the impedance line on or off for the specified port modes of theport you are currently defining.

Command: Port

Syntax: needimpedline mode toggle

Note: toggle: 0=no (off), 1=yes (on)Example: needimpedline 1 1

This example instructs the system to use a impedance line for the domi-nant (first) mode of the port you are defining. You still need to use the set-impedlinestart and setimpedlineend commands to specify the impedanceline itself.

PickFaceById

Use: Selects or deselects the specified face of an object.Command: Edit/Select

Syntax: pickfacebyid “object name” face_id

Example: pickfacebyid “box1” 1

This example selects the first face on the object box1. If the first face werealready selected, this would deselect it.

PickFaceByRay

Use: Selects the face of an object intersecting a ray. This corresponds toselecting a face using the mouse (Graphical Pick should be set to Face).

Command: none

Syntax: pickfacebyray [ray start coordinates]

Example: pickfacebyray [2,4,6]

This example selects the face that intersects the path of a ray starting at[2,4,6] and moving towards the object.

PolarizeEField

Use: Toggles the polarization of the E-field on or off for the port you arecurrently defining.

Command: Port

Syntax: polarizeefield toggle

Note: toggle: 0=no (off), 1=yes (on)Example: polarizeefield 1

This example polarizes the E-field on the port you are currently defining.

Page 133: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Boundary Manager Script Commands 8-5

RenamePorts

Use: Reorganizes the names of defined ports into the format that Ansoft HFSSrequires. Ansoft HFSS requires that all port names start with portfollowed by a number.

Command: Model/Compact Port Names

Syntax: renameports

ReprioritizeSelBoundary

Use: Changes the order of the selected boundary in the Boundary list. For anexplanation on how the order of the boundaries affects the problem, referto the “Order of Operations” section in the online documentation. Youmust select a boundary before using this command.

Command: Edit/Reprioritize Boundary/Source

Syntax: reprioritizeselboundary

SelectObjByName

Use: Selects an object by name.Command: none

Syntax: selectobjbyname “object name”

Example: selectobjbyname “box1”

This example selects the object box1.SelectObjFaces

Use: Selects all faces on the specified object.Command: none

Syntax: selectobjfaces “object name”

SetAllBndUnitsToCurrent

Use: Sets all boundary units to the units being used in the model. Use this afteryou have used the command setunitsofquant (from the Default commandset) to select the new units.

Command: none

Syntax: setallbndunitstocurrent

SetBndName

Use: Assigns a name to the boundary.Command: All boundaries and sources

Syntax: setbndname “boundary name”

Page 134: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

8-6 Boundary Manager Script Commands

SetBndUnitsToCurrent

Use: Sets boundary units of the selected boundary to the units being used inthe model. Use this after you have used the command setunitsofquant(from the Default command set) to select the new units.

Command: Units

Syntax: setbndunitstocurrent

SetBoolean

Use: Sets the symmetry boundary to perfect E or perfect H.Command: Symmetry

Syntax: setboolean toggle

Note: toggle: 0=perfect H, 1=perfect EExample: setboolean 1

This example defines the symmetry boundary as a perfect E symmetryboundary.

SetBoundary

Use: Sets the boundary to the specified boundary condition.Command: All boundaries and sources

Syntax: setboundary “boundary type”

Note: Select one of the following for boundary type:portincident_wavevoltage_dropcurrentmagnetic_biasperfect_eperfect_hresistorimpedanceradiationsymmetrymasterslave

Example: setboundary “port”

This example defines the boundary for the selected surface as a port. Youwill still need to use the other commands listed in this chapter to definethe port settings.

Page 135: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Boundary Manager Script Commands 8-7

SetCalibLineEnd

Use: Defines the end point for the calibration line on the specified port mode.Command: Port

Syntax: setcaliblineend mode [end position]

Example: setcaliblineend 2 [10,10,10]

This example sets the end point of the calibration line on the second portmode to the coordinates [10,10,10].

SetCalibLineStart

Use: Defines the start point for the calibration line on the specified port mode.Command: Port

Syntax: setcaliblinestart mode [start position]

Example: setcaliblinestart 2 [0,0,0]

This example sets the start point of the calibration line on the second portmode to the coordinates [0,0,0].

SetCoordSystem

Use: Sets the coordinate system in which to define the vectors of the incidentwave.

Command: Incident Wave

Syntax: setcoordsystem “coordinate system”

Note: Select one of the following coordinate systems:cartesianspherical

Example: setcoordsystem “cartesian”

This example specifies the cartesian coordinate system as the coordinatesystem in which to define the vectors of the incident wave.

SetCurrentFlowLineEnd

Use: Sets the lumped RLC current flow line end point. Use this in conjunctionwith setcurrentflowlinestart.

Command: Boundary

Syntax: setcurrentflowlineend [end point]

Example: setcurrentflowlineend [10,10,10]

This example sets the end point of the lumped RLC current flow line tothe coordinates [10,10,10].

Page 136: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

8-8 Boundary Manager Script Commands

SetCurrentFlowLineStart

Use: Sets the lumped RLC current flow line start point. Use this in conjunctionwith setcurrentflowlineend.

Command: Boundary

Syntax: setcurrentflowlinestart [start point]

Example: setcurrentflowlinestart [1,1,1]

This example sets the start point of the lumped RLC current flow line tothe coordinates [1,1,1].

SetEndpoint

Use: Defines the end point of the vectors that define the direction of current orvoltage sources. Use this in conjunction with setstartpoint.

Command: Voltage drop and Current

Syntax: setendpoint [end point]

Example: setendpoint [0,1,2]

This example specifies the end point of the vector defining the directionof the source (voltage or current) as [0,1,2].

SetImpedanceMultiplier

Use: Defines the impedance multiplier for the problem.Command: Port

Syntax: setimpedancemultiplier “value”

Example: setimpedancemultiplier “0.5”

This example sets the impedance multiplier for the problem to 0.5.SetImpedLineEnd

Use: Defines the end point for the impedance line on the specified port mode.Command: Port

Syntax: setimpedlineend mode [end position]

Example: setimpedlineend 2 [10,10,10]

This example sets the end point of the impedance line on the second portmode to the coordinates [10,10,10].

SetImpedLineStart

Use: Defines the start point for the impedance line on the specified port mode.Command: Port

Syntax: setimpedlinestart mode [start position]

Example: setimpedlinestart 2 [0,0,0]

This example sets the start point of the impedance line on the second portmode to the coordinates [0,0,0].

Page 137: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Boundary Manager Script Commands 8-9

SetLumpedPort

Use: Defines a port as a gap source (lumped 2D port).Command: Port

Syntax: setlumpedport yes/no

Note: yes/no: 0=No, 1=YesSetNumOfModes

Use: Specifies the number of modes for a port.Command: Port

Syntax: setnumofmodes number

Example: setnumofmodes 2

This example assigns two modes to the port you are currently defining.SetOrigin

Use: Defines the origin of the coordinate system on the master and slaveboundaries.

Command: Master and Slave

Syntax: setorigin [origin coordinates]

Example: setorigin [2,2,2]

This example places the origin of the coordinate system at [2,2,2] (of theglobal coordinate system) for the boundary you are currently defining.

SetRLCType

Use: Sets the type of lumped RLC boundary.Command: Boundary

Syntax: setrlctype “rlc value type” value present “value”

Example: setrlctype “resistance” 1 “10” setrlctype “inductance”1 “20”

This example sets a boundary with a combination of lumped resistanceand inductance.

SetScalar

Use: Defines the scalar value for a current or voltage source in amperes orvolts.

Command: Voltage drop and Current

Syntax: setscalar “value”

Example: setscalar “2”

This example sets the value for the source (current or voltage) you arecurrently defining to 2.

Page 138: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

8-10 Boundary Manager Script Commands

SetScalarFor

Use: Sets the scalar value of the defined parameter.Command: Incident Wave, Magnetic Bias, Finite Conductivity, Impedance, Slave

Syntax: setscalarfor “parameter” “value”

Note: The following parameters are supported:

SetStartPoint

Use: Defines the start point of the vectors that define the direction of current orvoltage sources. Use this in conjunction with setendpoint.

Command: Voltage drop and Current

Syntax: setstartpoint [end point]

Example: setstartpoint [0,1,2]

This example specifies the start point of the vector defining the directionof the source (voltage or current) as [0,1,2].

MagneticBias

IncidentWave

FiniteConductivity

Impedance Slave

bias_magbias_xanglebias_yanglebias_zangle

kxkykzexeyezphi_startphi_endnum_phi_ptstheta_starttheta_endnum_theta_pointsephietheta

conductivitypermeability

reactanceresistance

ms_phi_valuems_theta_value

Page 139: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Boundary Manager Script Commands 8-11

SetStringFor

Use: Sets the value for the defined parameter. For example, when you aredefining a slave boundary, you must specify the master boundaryassociated with the slave boundary, which you can do using theSetStringFor command.

Command: Magnetic Bias and Slave

Syntax: setstringfor “parameter“ “string value”

Note: The following parameters and their string values are supported:

Example: setstringfor “bias_type” “uniform”

This example selects a uniform bias type for the Magnetic Bias source. Thestring value for master_name must match the name given to the masterboundary.

SetUpoint

Use: Defines the u-axis of the coordinate system on the master and slaveboundaries by specifying a point on the axis. This is used in conjunctionwith setorigin and setvpoint.

Command: Master and Slave

Syntax: setupoint [point coordinates]

Example: setupoint [4,2,2]

This example places the u-axis of the coordinate system so that it passesthrough the point [4,2,2] of the global coordinate system.

SetVpoint

Use: Defines the v-axis of the coordinate system on the master and slaveboundaries by specifying a point on the axis. This is used in conjunctionwith setorigin and setupoint.

Command: Master and Slave

Syntax: setvpoint [origin coordinates]

Example: setvpoint [2,4,2]

This example places the v-axis of the coordinate system so that it passesthrough the point [4,2,2] of the global coordinate system.

Parameter String Value

master_name Master boundary name

bias_type uniformnon-uniform

Page 140: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

8-12 Boundary Manager Script Commands

SwapBoolean

Use: Swaps the symmetry boundary type between perfect E and perfect H.Command: Symmetry

Syntax: swapboolean

TogglePickBndByName

Use: Selects the specified boundary.Command: none

Syntax: togglepickbndbyname “boundary name”

TogglePickBndByRay

Use: Selects the boundary that intersects a ray. This corresponds to selecting aboundary using the mouse (Graphical Pick should be set to Boundary).

Command: none

Syntax: togglepickbndbyray [ray start coordinates]

Example: togglepickbndbyray [2,4,6]

This example selects the boundary that intersects the path of a ray start-ing at [2,4,6] and moving towards the boundary.

TogglePickObjByName

Use: Selects the specified object.Command: Edit/Select/By Name

Syntax: togglepickobjbyname “object name”

TogglePickObjByRay

Use: Selects the object that intersects a ray. This corresponds to selecting anobject using the mouse (Graphical Pick should be set to Object).

Command: none

Syntax: togglepickobjbyray [ray start coordinates]

Example: togglepickobjbyray [2,4,6]

This example selects the object that intersects the path of a ray starting at[2,4,6] and moving towards the object.

TogglePickObjObjInt

Use: Selects the intersecting faces of two 3D objects.Command: Edit/Select/Faces Intersection

Syntax: togglepickobjobjint “first object” “second object”

UndoClear

Use: Restores the values of the last boundary or source clear.Command: Edit/Undo Clear

Syntax: undoclear

Page 141: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Meshmaker Script Commands 9-1

9

Meshmaker Script Commands

This chapter describes the script commands specific to the Meshmaker. Referto Appendix A, “Module Script Commands,” for a complete list of the com-mands available in the Executive module.The Meshmaker module uses the following command sets:● Generic module● mod3proj● mod3view● Default● mesh3dThe Generic module, mod3proj, mod3view, and Default command sets aredescribed in Chapter 3 and Chapter 4. This chapter describes the mesh3d com-mand sets.

Page 142: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

9-2 Meshmaker Script Commands

Mesh3D Script CommandsThe following script commands are classified as Mesh3D script commands.

CloseProject

Use: Closes the project window.Command: none

Syntax: closeproject

DeleteAllSeed

Use: Deletes all seeding operations in the mesh.Command: Seed/Delete All

Syntax: deleteallseed

DeleteAllSeedNonInteractively

Use: Deletes all mesh seeding non-interactively, without warnings or dialogs.Command: none

Syntax: deleteallseednoninteractively

DeleteMesh

Use: Deletes the mesh.Command: Mesh/Delete

Syntax: deletemesh

DelSelFaces

Use: Deselects all selected faces in the model.Command: Edit/Deselect All Faces

Syntax: delselfaces

DeSelBodies

Use: Deselects all objects in the model.Command: Edit/Deselect All Bodies

Syntax: deselbodies “objects to deselect”

DoModelAnalysis

Use: Performs the model analysis. The command assumes that a proximityanalysis has already been done.

Command: none

Syntax: domodelanalysis

Exit

Use: Exits the Meshmaker, without checks or warnings.Command: none

Syntax: exit

Page 143: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Meshmaker Script Commands 9-3

FurtherImproveQuality

Use: Improves the mesh quality by combination swaps.Command: none

Syntax: furtherimprovequality

GExit

Use: Exits the 3D Meshmaker.Command: File/Exit

Syntax: gexit

GWriteMesh

Use: Saves the mesh.Command: File/Save

Syntax: gwritemesh

HiddenLineOff

Use: Displays the lines of the mesh in wireframe mode.Command: none

Syntax: hiddenlineoff

HiddenLineOn

Use: Displays the mesh in hidden line mode.Command: none

Syntax: hiddenlineon

HiddenLineOnOff

Use: Toggles hidden line elimination mode.Command: none

Syntax: hiddenlineonoff

HideAll

Use: Marks all objects in the model as invisible.Command: none

Syntax: hideall

HideMesh

Use: Hides the mesh from view, leaving only the model.Command: Mesh/Show Mesh

Syntax: hidemesh

Page 144: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

9-4 Meshmaker Script Commands

ImproveQuality

Use: Improves the mesh quality.Command: none

Syntax: improvequality

ImproveSurfTri

Use: Improves the surface triangulation.Command: none

Syntax: improvesurftri <pt addition limit (0.1 = 10% ofcurrent npts)> <give desired min angle in deg:> <givedesired max angle in deg:>

Note: pt addition limit: a value of 0.1 = 10% of current npts.Example: improvesurftri 0.1 15 45

This reads the surface triangulation and improves it using 10% of its cur-rent node points, with triangles having base angles in the range of 15 to45 degrees.

InteractiveDeleteMesh

Use: Deletes the current mesh.Command: Mesh/Delete

Syntax: interactivedeletemesh

InteractiveMakeInitMesh

Use: Makes the initial mesh, displaying a progress window and Abort button.Command: Mesh/Make

Syntax: interactivemakeinitmesh

MakeInitialMesh

Use: Generates the initial mesh, with no progress window or Abort button.Command: Mesh/Make

Syntax: makeinitialmesh

MeshDisplayMode

Use: Defines the display mode of the mesh.Command: Mesh/Display Parameters

Syntax: meshdisplaymode “display mode”

Note: display mode: shaded, none, wireframe, or hidden_line.MeshInfo

Use: Displays mesh information.Command: Mesh/Mesh Info

Syntax: meshinfo

Page 145: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Meshmaker Script Commands 9-5

ModelAlone

Use: Turns off the mesh display, leaving only the model.Command: none

Syntax: modelalone

NewProject

Use: Creates a project.Command: File/New

Syntax: newproject “project name”

NonInteractiveDeleteMesh

Use: Deletes the mesh without warnings or dialogs.Command: Mesh/Delete

Syntax: noninteractivedeletemesh

OpenProject

Use: Opens a project and read in mesh files.Command: File/Open

Syntax: openproject “project name”

PullPointsToTrueSurfaces

Use: Moves the points that should be on the true surfaces to the true surfaces.Command: none

Syntax: pullpointstotruesurfaces

RefreshView

Use: Refreshes the view in the mesh window.Command: none

Syntax: refreshview

SaveSeed

Use: Saves all seeding operations to a file.Command: File/Save

Syntax: saveseed

Page 146: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

9-6 Meshmaker Script Commands

SaveWindow

Use: Saves the current view window to a graphics file. Currently, only bmp isfunctional. The command also appears in the Post Processor 3Dcommand set.

Command: none

Syntax: savewindow “filename” type

Note: type: Choose from one of the following:

SeedingInfo

Use: Displays seeding information.Command: Seed/Seeding Info

Syntax: seedinginfo

Number File type

0 bmp

1 ppm

2 gif

3 pict

4 rgb

5 tiff

6 ps

Page 147: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Meshmaker Script Commands 9-7

SeedRefineCommandToKernel

Use: Defines the type of seeding and refinement non-graphically.Command: none

Syntax: seedrefinecommandtokernel “type of refinement/seeding”“tagging criterion” “gather scope” <refine elements tothis value (floating point 10)> <limit growth to thisnumber of elements (integer 1000)> <skin depth tau(floating point 10)> <skin depth epsilon (floatingpoint 10)> <skin depth growth ratio (floating point10)> <skin depth (integer 10)> <number of layers forskin depth refinement (integer 3) > <x coordinate oflower left corner of box for box-refinement floatingpoint -1.0> <y coordinate of lower left corner of boxfor box-refinement floating point -1.0> <z coordinateof lower left corner of box for box-refinementfloating point -1.0> <x coordinate of upper rightcorner of box for box-refinement floating point 1.0><y coordinate of upper right corner of box for box-refinement floating point 1.0> <z coordinate of upperright corner of box for box-refinement floating point1.0>

Note: type of refinement/seeding:face_seed, obj_surf_seed, obj_seed, box_seed, sphere_seed,cylinder_seed, face_refine, obj_surf_refine, obj_refine, box_refine,sphere_refine, cylinder_refine, lambda_refine, port_needle_refine,eddy_pml_seed, eddy_pml_refinetagging criterion: tag_by_size=0, tag_by_shape, tag_by_tri_area,tag_by_lensqr, tag_by_shape_over_size, tag_by_needle_factor,tag_undefined

gather scope:gather_by_solid_id=0, gather_in_a_box, gather_in_a_cylinder,gather_near_solid_surfaces, gather_near_faces, gather_all_tets,gather_all_non_background_tets

Limit growth to this number of element: LONGSkin depth tau: DOUBLEX coord of Lower left of box for box-refinement floating point: DOUBLEY coord of Lower left of box for box-refinement floating point: DOUBLEZ coord of Lower left of box for box-refinement floating point: DOUBLEX coord of Upper right of box for box-refinement floating point: DOUBLEY coord of Upper right of box for box-refinement floating point: DOUBLEZ coord of Upper right of box for box-refinement floating point: DOUBLE

Page 148: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

9-8 Meshmaker Script Commands

SelectOneFace

Use: Selects a face of an object by its id number non-graphically.Command: Edit/Select Faces

Syntax: selectoneface face_id_number

SelFaces

Use: Select faces for seeding or refinement graphically, using the mouse.Command: Edit/Select Faces

Syntax: selfaces

SetBoxScope

Use: Defines the mesh display scope. Only the portion of the mesh within thescope will be plotted.

Command: none

Syntax: setboxscope <mesh display scope> <x coordinate oflower left corner of box for box-refinement floatingpoint -1.0> <y coordinate of lower left corner of boxfor box-refinement floating point -1.0> <z coordinateof lower left corner of box for box-refinementfloating point -1.0> <x coordinate of upper rightcorner of box for box-refinement floating point 1.0><y coordinate of upper right corner of box for box-refinement floating point 1.0> <z coordinate of upperright corner of box for box-refinement floating point1.0>

Note: Mesh display scope: 0=all_mesh, 5=inside_sel_boxExample: setboxscope 0 <0 0 0> <100 100 100>

This example displays the mesh on the entire object in the region from theorigin to [100,100,100].

SetDisplayOn

Use: Turns on the model display.Command: none

Syntax: setdisplayon state

Note: state: TRUE/FALSE = 1/0

Page 149: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Meshmaker Script Commands 9-9

SetFaceterRefinements

Use: Defines the refinement settings for ACIS facetting.Command: Mesh/Make

Syntax: setfaceterrefinements “type of surface” “type ofsetting” <value to be set>

Note: type of surface: plane, cone, sphere, torus or splinetype of setting: aspect_ratio, normal_deviation, orsurface_deviationvalue to be set: normal deviation in degrees, surface deviation inmodel units

SetMeshDisplayMode

Use: Defines the mesh display mode.Command: none

Syntax: setmeshdisplaymode mode_number

Note: mode_number:■ 1 for shaded mesh■ 2 for wireframe mesh■ 3 for hidden line mesh

SetTriScope

Use: Defines which faces get plotted and which are skipped during theplotting process.

Command: none

Syntax: settriscope scope_number

Note: Mesh display scope:■ 2 for plotting on all faces.■ 3 for plotting only on selected faces.■ 4 for plotting only on unselected faces.

SetViewKindWireFrame

Use: Sets the window to display wireframe meshes.Command: none

Syntax: setviewkindwireframe

ShadedMesh

Use: Displays the mesh in shaded form in the window.Command: none

Syntax: shadedmesh

Page 150: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

9-10 Meshmaker Script Commands

ShowHideMesh

Use: Toggles by displaying or hiding the mesh.Command: Mesh/Show Mesh

Syntax: showhidemesh

ShowMesh

Use: Displays the mesh in the 3D Meshmaker window.Command: Mesh/Show Mesh

Syntax: showmesh

ShowPoints

Use: Displays the points of the mesh.Command: none

Syntax: showpoints

ShowSurfTri

Use: Displays the surface triangles of the initial mesh.Command: Mesh/Display Parameters

Syntax: showsurftri

ShowTets

Use: Displays the tetrahedra of the mesh.Command: Mesh/Display Parameters

Syntax: showtets

SmoothenMesh

Use: Applies a LaPlacian smoothing to the mesh. This command moves thenodes of the mesh to create a smoother point distribution.

Command: none

Syntax: smoothenmesh num_passes

WriteMesh

Use: Writes out the mesh to set of files.Command: none

Syntax: writemesh

WriteMeshAs

Use: Opens a file browser, allowing you to save the mesh file sets under a newname.

Command: File/Save As

Syntax: writemeshas

Page 151: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Post Processor Script Commands 10-1

10

Post Processor Script Commands

This chapter describes the script commands specific to the three post-process-ing modules available in Ansoft HFSS. Refer to Appendix A, “Module ScriptCommands,” for a complete list of the commands available in these modules.Each post-processing module uses the following generic command setsdescribed in Chapter 3 and Chapter 4:● Generic module● mod3proj● mod3view● DefaultThe 3D Post Processor has these additional command sets:● HFSS● PostProcessor3D● Plot 3D● FieldCalculator

The Matrix Data Post Processor has these additional command sets:● HFSS (as described in Chapter 5, “Executive Script Commands”)● MatrixDataThe Matrix Plot Post Processor has an additional command set called MatrixPlot.This chapter describes the post-processing modules’ command sets.

☞Note: Since the HFSS command set for the 3D Post Processor is completely differ-

ent from the HFSS command set in the Executive module, it is treated as aseparate command set here.

Page 152: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-2 Post Processor Script Commands

3D Post Processor Command SetsThe HFSS, PostProcessor3D, Plot 3D, and FieldCalculator command sets areavailable in the 3D Post Processor.

HFSS Script CommandsThe following script commands are classified as HFSS script commands.

ClearRadiatedFields

Use: Clears the computed radiated fields.Command: Radiation/Clear

Syntax: clearradiatedfields

ComputeFarField

Use: Computes the far field using the current settings for phi and theta. Usethe SetPhiValues and SetThetaValues commands to set the values for phiand theta.

Command: Radiation/Compute/Far Field

Syntax: computefarfield

ComputeNearField

Use: Computes the near field using the current settings for phi and theta. Usethe SetPhiValues and SetThetaValues commands to set the values for phiand theta.

Command: Radiation/Compute/Near Field

Syntax: computenearfield

ComputeNearFieldOnLines

Use: Sets the lines on which to compute the near field.Command: Radiation/Compute/Near Field

Syntax: computenearfieldonlines {“line1” “line2” ...}

Example: computenearfieldonlines {“redline” “blueline”}

This example sets the two lines redline and blueline as the lines to com-pute the near field on. Use the ComputeNearField command to computethe near field on these lines.

CreateFarFieldPlot

Use: Accesses the Plot Far Field window, from which you can specify the far-field plot settings.

Command: Plot/Far Field

Syntax: createfarfieldplot

Page 153: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-3

CreateNearFieldPlot

Use: Accesses the Plot Near Field window, from which you can specify thenear-field plot settings.

Command: Plot/Near Field

Syntax: createnearfieldplot

CreateRadFieldPlotObject

Use: Creates a temporary file in memory where the settings for the radiatedfields are stored. When you create a plot using the GenerateFieldPlotscommand, the settings in this file are used for the plot.

Command: none

Syntax: createradfieldplotobject “field type”

Note: field type: farfld=Far Field, nearfld=Near FieldExample: createradfieldplotobject “farfld”

This example creates the temporary file farfld in memory. The far-fieldplot settings are stored in the file.

dBPlot

Use: Specifies whether or not to plot in dB.Command: Plot/Far Field and Plot/Near Field

Syntax: dbplot yes/no

Note: yes/no: 0=No, 1=YesDisplayFarFieldData

Use: Displays the far-field antenna parameters and maxima data.Command: Radiation/Display Data/Far Field

Syntax: displayfarfielddata

DisplayNearFieldData

Use: Displays the near-field maxima data.Command: Radiation/Display Data/Near Field

Syntax: displaynearfielddata

Page 154: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-4 Post Processor Script Commands

GenerateFieldPlots

Use: Generates the radiated field plots using the plot settings stored in thetemporary file created by the CreateRadFieldPlotObject command.

Command: Radiation/Compute/Far Field and Radiation/Compute/Near Field

Syntax: generatefieldplots “field type”

Note: field type: farfld=Far Field, nearfld=Near FieldExample: generatefieldplots “farfld”

This example creates a far-field plot using the settings stored in the filefarfld.

GetAntennaParameter

Use: Returns the beam area, directivity, radiated power, and maximumradiation intensity Ansoft HFSS has calculated. This information can thenbe saved to a file or assigned to variables and used by other scriptcommands.

Command: none

Syntax: getantennaparameter “parameter”

Note: Use one of the following for “parameter”:Beam AreaDirectivityRadiated PowerAccepted PowerRadiation EfficiencyMax. U (theta,phi)

Example: Assign beam_area getantennaparameter “Beam Area”

This example assigns the value of the beam area to the variablebeam_area. You can then manipulate this variable as you would anyother.

Page 155: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-5

GetRadiatedEFieldMaxPos

Use: Returns the position of the maximum radiated field data Ansoft HFSS hascalculated. The position returned is given as (r, theta, phi). For far fields, ris not given since it is infinite. This information can then be saved to a fileor assigned to variables and used by other script commands.

Command: none

Syntax: getradiatedefieldmaxpos rad_field “geometry”“polarization”

Note: rad_field: 0=Near Field, 1=Far FieldUse one of the following for “geometry”:

Sphere = spherical geometrylinename = the name of the line to plot on

Use one of the following for “Polarization”:XYZPhiThetaLHCPRHCPLudwig 3/X dominantLudwig 3/Y dominant

Example: Assign total getradiatedefieldmaxpos 1 “Sphere” “Phi”

This example assigns the position of the maximum of the far field in thephi direction on a sphere to the variable total. You can then manipulatethis variable as you would any other.

Page 156: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-6 Post Processor Script Commands

GetRadiatedEFieldMaxVal

Use: Returns the value of the maximum of the radiated field data Ansoft HFSShas calculated. This information can then be saved to a file or assigned tovariables and used by other script commands.

Command: none

Syntax: getradiatedefieldmaxval rad_field “geometry”“component”

Note: rad_field: 0=Near Field, 1=Far FieldUse one of the following for “geometry”:

Sphere = spherical geometrylinename = the name of the line to plot on

Use one of the following for “Component”:XYZPhiThetaLHCPRHCPLudwig 3/X dominantLudwig 3/Y dominant

Example: Assign total getradiatedefieldmaxval 0 “line1” “RHCP”

This example assigns the maximum value of the right-hand circularlypolarized near field on the line line1 to the variable total. You can thenmanipulate this variable as you would any other.

Page 157: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-7

GetRadiatedFieldQuantity

Use: Returns the value of the selected far or near field quantity at the specifiedphi and theta location.

Command: none

Syntax: getradiatedfieldquantity rad_field “quantity”“polarization” “complex component name” theta_indexphi

Note: rad_field: 0=Near Field, 1=Far Fieldquantity: Enter one of the following:

polarization: For each quantity, use one of the following:

component name: Select from Magnitude, Phase, Real, or Imaginary.Theta index refers to the counter that is used for how many cuts oftheta were calculated.

Example: getradiatedfieldquantity 1 “Antenna DirectivityPattern” “Phi” ““ 0 0

This displays the value of the field in the phi direction for the antennadirectivity pattern at theta index equal to 0, phi equal to 0. Since theantenna directivity pattern does not have a component, that string is leftempty.

Near Field Far FieldE Component FieldE Total Field

Antenna Directivity PatternAntenna Gain PatternAxial RatioPolarization RatiorE Component FieldrE Total FieldRadar Cross SectionNormalized RCS

AntennaDirectivity

Pattern

Antenna GainPattern

PolarizationRatio

rE and EComponent Field

PhiThetaXYZ

LHCPRHCP

Ludwig 3/X DominantLudwig 3/Y Dominant

PhiThetaXYZ

LHCPRHCP

Ludwig 3/X DominantLudwig 3/Y Dominant

Circular/LHCPCircular/RHCPSpherical/Phi

Spherical/ThetaLudwig 3/XLudwig 3/Y

PhiThetaXYZ

LHCPRHCP

Ludwig 3/X DominantLudwig 3/Y Dominant

Page 158: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-8 Post Processor Script Commands

LoadRadiatedFields

Use: Loads saved radiated fields from the file you specify.Command: Radiation/Load Fields

Syntax: loadradiatedfields “file name”

Example: loadradiatedfields “radiated.dat”

This example loads the radiated fields saved in the file radiated.dat.PlotNormalized

Use: Specifies whether or not to normalize the field quantities to be plottedwith respect to their maximum value.

Command: Plot/Far Field and Plot/Near Field

Syntax: plotnormalized yes/no

Note: yes/no: 0=No, 1=YesReComputeFields

Use: Recomputes the field solutions using the new value for sourcemagnitude, source phase, or frequency. Before using this command youmust first modify the source magnitude, source phase, or frequency.

Command: Data/Edit Sources

Syntax: recomputefields

SaveRadiatedFields

Use: Saves radiated fields to the file you specify.Command: Radiation/Load Fields

Syntax: saveradiatedfields “file name”

Example: saveradiatedfields “radiated.dat”

This example saves the radiated fields to the file radiated.dat.ScaleSourceMagnitude

Use: Scales the magnitude of the specified source. Sources are first defined inthe 3D Boundary Manager.

Command: Data/Edit Sources

Syntax: scalesourcemagnitude “source name” scale

Example: scalesourcemagnitude “vfeed” 3

This example scales the magnitude of the source vfeed by 3. If vfeed wereoriginally defined as 10, its magnitude would now be 30.

Page 159: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-9

SetComplexCompToPlot

Use: Specifies the complex components (if there are any) to plot.Command: Radiation/Compute/Far Field and Radiation/Compute/Near Field

Syntax: setcomplexcomptoplot {“component1” “component2” ...}

Note: You may select from the following components:MagnitudePhaseRealImaginary

Example: setcomplexcomptoplot {“Magnitude” “Phase”}

This example selects magnitude and phase as the complex components toplot.

SetCurrGeometry

Use: Specifies the geometry on which to plot the radiated fields. Thiscommand is only used when plotting the near field.

Command: Plot/Near Field

Syntax: setcurrgeometry “geometry”

Note: You may use the following geometries:SphereLine

Example: setcurrgeometry “Sphere”

This example selects a spherical surface on which to plot the near field.SetLineIndepVariable

Use: Specifies the independent variable — x, y, z, or r — on which to plot thenear field. Use this when you have computed the near field on a line.

Command: Plot/Near Field

Syntax: setlineindepvariable “variable”

Example: setlineindepvariable “x”

This example selects x-axis against which to plot the near field.SetLinesToPlotOn

Use: Specifies the line segments on which to plot the near field.Command: Plot/Near Field

Syntax: setlinestoploton {“line1” “line2” ...}

Page 160: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-10 Post Processor Script Commands

SetNearFieldComputeGeometry

Use: Specifies the geometry on which to calculate the radiated fields. Thiscommand is only used for near-field calculations.

Command: Radiation/Compute/Near Field

Syntax: setnearfieldcomputegeometry “geometry”

Note: You may use the following geometries:SphereLine

Example: setnearfieldcomputegeometry “Sphere”

This example selects a spherical surface on which to calculate the nearfield.

SetPhiValues

Use: Sets the stop, start, and number of steps for the phi values whencomputing radiated fields on a spherical surface.

Command: Radiation/Compute/Far Field and Radiation/Compute/Near Field

Syntax: setphivalues start stop steps

Example: setphivalues 0 90 11

This example sets the start value of phi to 0 degrees, the stop value to 90degrees, and the number of steps on the sweep to 11.

SetPlotPhiValues

Use: Selects the phi angles to plot. Phi must be selected as the fixed variableusing the SetSphereFixedVar command.

Command: Plot/Far Field and Plot/Near Field

Syntax: setplotphivalues “phi values”

Example: setplotphivalues “0 9 18 27”

This example instructs the system to display values for vertical cross sec-tions at the phi cuts — 0, 9, 18, and 27 — of the problem region at a set oftheta rotations.

SetPlotQuantity

Use: Selects the quantity to plot. For a list of quantities to plot, refer to theGetRadiatedFieldQuantity description.

Command: Plot/Far Field and Plot/Near Field

Syntax: setplotquantity “quantity”

Example: setplotquantity “Antenna Directivity Pattern”

This example selects the Antenna Directivity Pattern as the quantity toplot.

Page 161: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-11

SetPlotThetaValues

Use: Selects the theta angles to plot. Theta must be selected as the fixedvariable using the SetSphereFixedVar command.

Command: Plot/Far Field and Plot/Near Field

Syntax: setplotthetavalues “phi values”

Example: setplotthetavalues “0 9 18 27”

This example instructs the system to display values for horizontal crosssections at the theta cuts — 0, 9, 18, and 27 — of the problem region at aset of phi rotations.

SetPolarizationToPlot

Use: Selects the polarization to plot.Command: Plot/Far Field and Plot/Near Field

Syntax: setpolarizationtoplot {“polarization1” “polarization2”...}

Note: For a list of the polarizations you can plot, refer to theGetRadiatedFieldQuantity description.

Example: setpolarizationtoplot {“Circular/LHCP” “Ludwig 3/X”}

This example selects Circular/LHCP and Ludwig 3/X as the polarizationsto plot.

SetRadiationSurface

Use: Specifies the surface over which to integrate the radiated fields. Normallyyou will use the surface defined as the radiation boundary — abc-surface— in the 3D Boundary Manager. If you are using a custom surface, youmust define that surface before you can select it as the radiation surface.

Command: Radiation/Compute/Far Field and Radiation/Compute/Near Field

Syntax: setradiationsurface “surface name”

Example: setradiationsurface “abc-surface”

This example selects the surface defined as the radiation boundary as thesurface over which to integrate the radiated fields.

SetSourcePhase

Use: Sets the phase of the specified source. Sources are first defined in the 3DBoundary Manager.

Command: Data/Edit Sources

Syntax: setsourcephase “source name” value

Example: setsourcephase “vfeed” 180

This example sets the phase of the source vfeed to 180 degrees.

Page 162: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-12 Post Processor Script Commands

SetSphereFixedVar

Use: Specifies the variable — theta or phi — to hold fixed. Use this commandwhen you are plotting the radiated fields on a spherical surface.

Command: Plot/Far Field and Plot/Near Field

Syntax: setspherefixedvariable “variable”

Example: setspherefixedvariable “Phi”

This example selects phi as the fixed variable. The variables are case sen-sitive.

SetSphereRadius

Use: Sets the radius (in the current units) at which to compute the radiatedfields in the near-field region.

Command: Radiation/Compute/Near Field

Syntax: setsphereradius radius

Example: setsphereradius 3

This example sets the radius at which to compute the radiated fields to 3.SetSphericalPlotType

Use: Sets the plot type — 2D Polar, 2D Cartesian, or 3D Polar — of thespherical plot.

Command: Plot/Far Field and Plot/Near Field

Syntax: setsphericalplottype “type name”

Example: setsphericalplottype “2D Cartesian”

This example sets the spherical plot type to 2D Cartesian.SetThetaValues

Use: Sets the stop, start, and number of steps for the theta values whencomputing radiated fields on a spherical surface.

Command: Radiation/Compute/Far Field and Radiation/Compute/Near Field

Syntax: setthetavalues start stop steps

Example: setthetavalues 0 180 20

This example sets the start value of theta to 0 degrees, the stop value to180 degrees, and the number of steps on the sweep to 20.

SpecifyFrequency

Use: Sets the frequency at which to compute the field solution. This commandis only available for fast frequency sweeps. The frequency units are theunits specified using Setup Solution Options.

Command: Data/Edit Sources

Syntax: specifyfrequency value

Page 163: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-13

UpdateFarField

Use: Opens the Compute Far Field window.Command: Radiation/Compute/Far Field

Syntax: updatefarfield

UpdateNearField

Use: Opens the Compute Near Field window.Command: Radiation/Compute/Near Field

Syntax: updatenearfield

UseTotalField

Use: Selects total or scattered fields to use in post processing. This command isonly available when incident waves have been defined for the problem.

Command: Data/Edit Sources

Syntax: usetotalfield field

Note: field: 0=Scattered, 1=TotalExample: usetotalfield 0

This example instructs the 3D Post Processor to use scattered fields whenpost processing.

Page 164: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-14 Post Processor Script Commands

PostProcessor3D Script CommandsThe following script commands are classified as PostProcessor3D script com-mands.

ArrowPlotOptions

Use: Opens the Arrow Plot Options window, allowing you to specify the typeand size of arrows in a plot.

Command: none

Syntax: arrowplotoptions

CalcVisToggle

Use: Opens the calculator.Command: Data/Calculator

Syntax: calcvistoggle

CascadeAll

Use: Cascades all the open windows, stacking them.Command: Window/Cascade

Syntax: cascadeall

CascadeProjects

Use: Cascades all open project windows, stacking them.Command: Windows/Cascade

Syntax: cascadeprojects

CascadeViews

Use: Cascades all open view windows, stacking them.Command: Windows/Cascade

Syntax: cascadeviews

CHelp

Use: Displays context-sensitive help.Command: Help/On Context

Syntax: chelp

CloseProject

Use: Closes the active project.Command: File/Close

Syntax: closeproject

Page 165: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-15

CloseWindow

Use: Closes the active view window.Command: Window/Close

Syntax: closewindow

DeleteGeometry

Use: Allows you to select a geometry to delete from the window that appears.Command: Geometry/Delete

Syntax: deletegeometry

DeletePlot

Use: Deletes the specified plot.Command: Plot/Delete

Syntax: deleteplot “plot name”

DisablePlineStitch

Use: Disables stitching of polylines, so that polylines are not stitched togetheras they are created. Polyline stitching is enabled by default. UseEnablePlineStitch to enable the stitching of polylines.

Command: none

Syntax: disableplinestitch

EditBoundDisplay

Use: Opens the boundary display window and allows you to display theboundaries that were defined in the 3D Boundary Manager.

Command: Edit/Boundary Display

Syntax: editbounddisplay

EditFunctions

Use: Edits the function table.Command: Data/Functions/Edit

Syntax: editfunctions

EditPline

Use: Creates or edits a planar or 3D polyline. Very similar to the LineCreatecommand.

Command: none

Syntax: editpline “polyline/sheet object”

Example: editpline “Line1”

This example creates (or edits, if a line already exists with that name) apolyline named Line1. You then enter Edit Pline mode, and will need touse the EditPline script commands to create the polyline.

Page 166: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-16 Post Processor Script Commands

EditPline - AddVert

Use: Adds a vertex to the polyline.Command: Geometry/Create/Line

Syntax: addvert [x,y,z]

Example: addvert [0,0,0]

This example adds a vertex at the origin.EditPline - AddVert3D

Use: Adds a vertex to the polyline.Command: Geometry/Create/Line

Syntax: addvert3d x y z

Example: addvert3d 0 0 0

This example adds a vertex at the origin.EditPline - Arc

Use: Adds an arc to the current polyline.Command: Arc

Syntax: arc arc_angle

EditPline - CancelPline

Use: Exits the polyline or sheet edit mode.Command: none

Syntax: cancelpline

EditPline - ClosePline

Use: Connects the last vertex entered with the first vertex entered, creating aclosed loop.

Command: Geometry/Create/Line

Syntax: closepline

EditPline - DelEdge

Use: Deletes an edge of the polyline.Command: Geometry/Create/Line

Syntax: deledge edgenumber

Example: deledge 0

This example deletes the first line segment created. The line segmentnumbering begins at 0 with the first segment created. When you delete anedge, the segments created after that edge are renumbered.

Page 167: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-17

EditPline - DelVert

Use: Deletes the specified vertex.Command: Geometry/Create/Line

Syntax: delvert [x,y,z]

Example: delvert [0,0,0]

This example deletes the vertex at the origin.EditPline - EdgeGeom

Use: Changes the Edge Geometry of a segment.Command: Geometry/Create/Line

Syntax: edgegeom edge_number edge_geometry

Note: edge_geometry: 0=Straight, 1=Arc, 2=SplineExample: edgegeom 1 1

This example changes the second line segment to an arc segment. The linesegment numbering begins at 0 with the first segment created.

EditPline - EdgeMode

Use: Specifies the Edge Geometry mode.Command: Geometry/Create/Line

Syntax: edgemode edge_geometry

Note: edge_geometry: 0=Straight, 1=Arc, 2=SplineExample: edgemode 1

This example specifies the Edge Geometry mode as Arc. All segments cre-ated after this will be arc segments.

EditPline - EndPline

Use: Use this when you have finished creating or editing the polyline and youwish to save it.

Command: Geometry/Create/Line

Syntax: endpline

EditPline - EndTangent

Use: Makes an edge of the arc end tangent to the next edge.Command: Geometry/Create/Line

Syntax: endtangent edge_number

Example: endtangent 2

This example makes the edge of the arc (edge number 1) end tangent tothe next edge (edge number 2).

Page 168: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-18 Post Processor Script Commands

EditPline - FindPlineVertNo

Use: Finds the number for a specified vertex.Command: Geometry/Create/Line

Syntax: findplinevertno [x,y,z]

Example: findplinevertno [2,4,0]

This example finds the vertex number of the vertex at [2,4,0].EditPline - GetPlineVert

Use: Finds the position of the specified vertex number.Command: Geometry/Create/Line

Syntax: getplinevert vertex_number

Example: getplinevert 3

This example returns the position of the third vertex.EditPline - Insvert

Use: Inserts a vertex in the middle of a polyline.Command: Geometry/Create/Line

Syntax: insvert [vertex to insert before] [new position]

Example: insvert [2,4,0] [2,2,0]

This example inserts a new vertex at [2,2,0], before the vertex at [2,4,0].EditPline - JoinSplines

Use: Joins two splines that share a vertex.Command: Geometry/Create/Line

Syntax: joinsplines vertex_number

Example: joinsplines 3

This example joins the two polylines that share the third vertex.EditPline - MoveArcMidPt

Use: Moves the midpoint of an arc.Command: Geometry/Create/Line

Syntax: movearcmidpt edge_number [x,y,z]

Example: movearcmidpt 1 [2,2,0]

This example moves the midpoint of the arc (edge number 1) to [2,2,0].EditPline - MoveVert

Use: Moves a specified vertex.Command: Geometry/Create/Line

Syntax: movevert [vertex position] [new position]

Example: movevert [2,4,0] [2,2,0]

This example moves the vertex at [2,4,0] to [2,2,0].

Page 169: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-19

EditPline - OpenPline

Use: The opposite of closepline. This creates an opening in a closed polyline byremoving the segment that closed the loop.

Command: none

Syntax: openpline

EditPline - RenameCurPline

Use: Renames the polyline currently being edited.Command: Geometry/Modify/Line

Syntax: renamecurpline “new name”

EditPline - SetArcAngle

Use: Sets the angle of a polyline arc.Command: Geometry/Create/Line

Syntax: setarcangle edge_number angle

Example: setarcangle 1 60

This example sets the angle of the arc (edge number 1) to 60 degrees.EditPline - SetArcRadius

Use: Sets the radius of the polyline arc.Command: Geometry/Create/Line

Syntax: setarcradius edge_number radius

Example: setarcradius 1 10

This example sets the radius of the arc (edge number 1) to 10. The units ofthe radius are the units you specified in the 3D Modeler.

EditPline - SetArcToFillet

Use: Sets a polyline to be a fillet with the specified radius.Command: Geometry/Create/Line

Syntax: setarctofillet edge_number radius

Example: setarctofillet 1 10

This example sets the radius of the arc (edge number 1) to 10 and selectsFillet.

EditPline - SplitSpline

Use: Splits a spline in two at the specified vertex.Command: Geometry/Create/Line

Syntax: splitspline vertex_number

Example: splitspline 3

This example splits the splines at the third vertex.

Page 170: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-20 Post Processor Script Commands

EditPline - StartTangent

Use: Makes an edge of the arc start tangent to the previous edge.Command: Geometry/Create/Line

Syntax: starttangent edge_number

Example: starttangent 2

This example makes the edge of the arc (edge number 1) start tangent tothe previous edge (edge number 0).

EnablePlineStitch

Use: Enables stitch mode for polylines so that polylines are stitched together asthey are created. Polyline stitching is enabled by default. UseDisablePlineStitch to disable stitching for polylines.

Command: none

Syntax: enableplinestitch

Exit

Use: Exits the current module.Command: File/Exit

Syntax: exit

FormatPlotAxes

Use: Defines the axes labels and formats in active 2D plots.Command: Plot/Format Axes

Syntax: formatplotaxes

FormatPlotGraphs

Use: Formats the graphs in the active 2D plot.Command: Plot/Format Graphs

Syntax: formatplotgraphs

GeneralPlotOptions

Use: Displays the General Plot Options window, allowing you to specify thecolor and scaling preferences for the plot.

Command: none

Syntax: generalplotoptions

LinePlotOptions

Use: Displays the Line Plot Options window, allowing you to specify the colorand sizing preferences for a line plot.

Command: none

Syntax: lineplotoptions

Page 171: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-21

ListPlotsProject

Use: Lists all plots in the current project.Command: none

Syntax: listplotsproject

ListPlotsViews

Use: Lists all plots in the current view.Command: none

Syntax: listplotsviews

LoadCartesian3DPlot

Use: Loads and displays a 3D Cartesian plot in the plot window. You musthave created a plot prior to using this command.

Command: none

Syntax: loadcartesian3dplot “filename”

Note: You cannot add more than one trace to the plot.The input file has to be of the following format:

B_PLOT3D {[cartesian]} Heading str B_TRACE3D TraceName str B_LINES numlines num_points_on_line B_LINE x y z ... E_LINE ... E_LINES E_TRACE3DE_PLOT3D

Example: LoadCartesian3DPlot “plotlines”

This example loads the plotlines file and displays its associated plot on inthe plot window.

MarkerPlotOptions

Use: Displays the Plot Marker Options window, allowing you to specify thetype and size of the markers in the plot.

Command: none

Syntax: markerplotoptions

Page 172: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-22 Post Processor Script Commands

ModifyPlot

Use: Displays a window allowing you to modify an existing plot.Command: Plot/Modify

Syntax: modifyplot “plot name”

Example: modifyplot “plot1”

This example accesses a window that allows you to modify the name,scale, and color map of plot1.

ModifyVariables

Use: Modifies the variables in the function table.Command: Data/Functions/Modify

Syntax: modifyvariables

OpenProject

Use: Opens a solved project.Command: File/Open

Syntax: openproject “project name” “solution name”

Example: openproject “Vfastlow” “Vfastlow”

This example opens the solutions file in the project Vfastlow. The solu-tions file has the same name as the project.

PanelPlotDelete

Use: Deletes the existing plots.Command: Plot/Delete

Syntax: panelplotdelete

PanelPlotVisibility

Use: Edits the visibility of the plots in the active window.Command: Plot/Visibility

Syntax: panelplotvisibility

PostProcessorOptions

Use: Defines the user preferences for the settings of the 3D Post Processor.Command: Options/Preferences

Syntax: postprocessoroptions

Page 173: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-23

SaveDefinitions

Use: Saves the post-processing information to a file. The file has the samename as the project.

Command: File/Save

Syntax: savedefinitions

ShowCalc

Use: Displays the field calculator. This command is identical to CalcVisToggle.Command: Data/Calculator

Syntax: showcalc

ShowPlotCoordinates

Use: Shows the plot coordinates for the current mouse cursor location.Command: Plot/Show Coordinates

Syntax: showplotcoordinates

ShowSolutionInfo

Use: Displays solution and mesh information.Command: Data/Solution Info

Syntax: showsolutioninfo

TileAllGrid

Use: Displays all the view windows in tile mode.Command: Window/Tile

Syntax: tileallgrid

TileProjectsGrid

Use: Displays the project windows in tile mode.Command: Window/Tile

Syntax: tileprojectsgrid

TileViewsGrid

Use: Displays the view windows of the active project in tile mode.Command: Window/Tile

Syntax: tileviewsgrid

TogglePlotVisibility

Use: Toggles the visibility of the specified plots.Command: none

Syntax: toggleplotvisibility “plot name”

Example: toggleplotvisibility “plot1”

This example makes the plot plot1 visible (if it was not displayed) orinvisible (if it was displayed).

Page 174: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-24 Post Processor Script Commands

Plot 3D Script CommandsThe following script commands are classified as Plot 3D script commands.

Graph3dSetColor

Use: Sets the color of the lines on a graph. Select the color from the windowthat appears.

Command: none

Syntax: graph3dsetcolor

Graph3dSetFilled

Use: Displays the 3D graph as a shaded graph or a contour graph.Command: none

Syntax: graph3dsetfilled “filled yes/no”

Example: graph3dsetfilled “Yes”

This example displays the 3D graph as a shaded graph.Graph3dSetLine

Use: Defines the line attributes for graphs. Select the line attributes from thewindow that appears.

Command: none

Syntax: graph3dlineset

Graph3dSetOutline

Use: Displays the outline of the 3d graph.Command: none

Syntax: graph3dsetoutline draw_outline

Note: draw_outline: the LONG value of the outline.Graph3dSetRefinement

Use: Sets refinement levels for graphs, providing a smoother variation ofcolors.

Command: none

Syntax: graph3dsetrefinement level

Note: level: 0=Low, 1=Medium, 2=High

☞Note: The Plot 3D script commands require that a plot be present.

Page 175: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-25

Graph3dSetShade

Use: Turns lighting effects on or off.Command: none

Syntax: graph3dsetshade on/off

Note: on/off: 0=On, 1=OffGraph3DSetToneShaded

Use: Displays the 3d graph in tone shaded colors.Command: none

Syntax: graph3dsettoneshaded tone

Note: tone: number corresponds to a defined colormap shade.Graph3dUpdateGraph

Use: Updates the graph to incorporate any changes (such as changing the lineattributes with the Graph3dSetLine command).

Command: none

Syntax: graph3dupdategraph

Plot3dDrawAxes

Use: Turns the axes on or off.Command: none

Syntax: plot3ddrawaxes on/off

Note: on/off: 0=On, 1=OffPlot3dDrawGrid

Use: Turns the grid on or off.Command: none

Syntax: plot3ddrawgrid on/off

Note: on/off: 0=On, 1=OffPlot3dSetAxesLabelSize

Use: Sets the size of the axis labels.Command: none

Syntax: plot3dsetaxeslabelsize size

Example: plot3dsetaxeslabelsize 0.025

This example sets the size of the label for each axis to 0.025 points.

Page 176: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-26 Post Processor Script Commands

Plot3dSetColorMap

Use: Sets the type of color map to use for the graph. Select the type from thewindow that appears.

Command: none

Syntax: plot3dsetcolormap

Plot3dSetHeadExtrusion

Use: Extrudes the plot heading by the specified distance.Command: none

Syntax: plot3dsetheadextrusion distance

Plot3dSetHeading

Use: Sets the heading of the plot.Command: none

Syntax: plot3dsetheading “heading”

Plot3dSetHeadingColor

Use: Sets the color of the heading.Command: none

Syntax: plot3dsetheadingcolor color

Note: Because of the wide variety of colors, they are not listed here. Experimentwith various numbers to find a color you like.

Example: plot3dsetheadingcolor 1

This example changes the color of the heading to white.Plot3dSetHeadingFont

Use: Sets the font of the heading.Command: none

Syntax: plot3dsetheadingfont font

Note: Because of the wide variety of fonts, they are not listed here. Experimentwith various numbers to find a font you like.

Example: plot3dsetheadingfont 4

This example changes the font of the heading to Times Roman.Plot3dSetHeadingSize

Use: Sets the size of the heading.Command: none

Syntax: plot3dsetheadingsize size

Page 177: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-27

Plot3dSetLighting

Use: Toggles the lighting effect on or off for 3D plots.Command: none

Syntax: plot3dsetlighting on/off

Note: on/off: 0=On, 1=OffPlot3dSetScale

Use: Allows you to change the scale of the plot.Command: none

Syntax: plot3dsetscale auto min max divisions linear/log

Note: auto: 0=Use min/max settings, 1=Use autoscalelinear/log: 0=Linear, 1=Logarithmic

Example: plot3dsetscale 0 0 10 10 0

This example defines a linear scale using the minimum setting of 0, amaximum setting of 10, and 10 divisions.

Plot3dShowColorKey

Use: Toggles the color key on or off.Command: none

Syntax: plot3dshowcolorkey on/off

Note: on/off: 0=Off, 1=OnPlot3dUpdatePlots

Use: Updates the plots in the active window.Command: none

Syntax: plot3dupdateplots

Page 178: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-28 Post Processor Script Commands

FieldCalculator Script CommandsThe following script commands are classified as FieldCalculator script com-mands.

* (Multiply)

Use: Multiplies the contents of the top two registers on the stack.Command: Field Calculator

Syntax: *

+ (Add)

Use: Adds the contents of the top two registers on the stack.Command: Field Calculator

Syntax: +

– (Subtract)

Use: Subtracts the contents of the top two registers on the stack.Command: Field Calculator

Syntax: –

/ (Divide)

Use: Divides the top of the stack by the next entry.Command: Field Calculator

Syntax: /

1/

Use: Computes the inverse value of the top register of the calculator stack.Command: Field Calculator

Syntax: 1/

Abs

Use: Calculates the absolute value of the top of the stack.Command: Field Calculator

Syntax: abs

AddFaceAtPos

Use: Adds the face at the specified position to a faces list.Command: none

Syntax: addfaceatpos “faces list” “object” [face position]

Example: addfaceatpos “faces1” “abc” [10,5,0]

This example adds the face at [10,5,0] on the object abc to the faces listfaces1.

Page 179: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-29

AddFaceWithId

Use: Adds a face with the specified ID to a faces list.Command: Geometry/Create/Faces List

Syntax: addfacewithid “face list” “object” id

Example: addfacewithid “faces1” “abc” 1

This example adds the face with the ID number 1 to the faces list namedfaces1. The face ID number is unique for every face in the model; thenumber begins at 1 for the first object listed and increases with each fol-lowing object. For example, if you have two boxes, the first box in the listwould have faces 1-6, and the second box in the list would havefaces 7-12.

AddObjectToList

Use: Adds an object to an existing list.Command: Geometry/Create/Object List

Syntax: addobjecttolist “list name” “object name”

Example: addobjecttolist “condlist” “coppercyl”

This example adds the object coppercyl to the object list condlist.AnimationAddFrame

Use: Adds a frame in the current window to an animation.Command: Plot/Animation

Syntax: animationaddframe “plot name” “frame name” POSITION

Note: position refers to the frame’s position in the frame list. For example:-1 = Add to end of list 0 = Add to beginning of list 1 = Add after first frame 2 = Add after second frame

Example: animationaddframe “Animation1” “Frame1” -1

This example adds the frame Frame1 to the animation plot Animation1 atthe end of the frame list.

AnimationDeleteFrame

Use: Removes a frame from the animation. Note that the frame numberingbegins at zero.

Command: Plot/Animation

Syntax: animationdeleteframe “plot name” frame_number

Example: animationdeleteframe “Animation1” 0

This example deletes the first frame from the animation plot Animation1.

Page 180: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-30 Post Processor Script Commands

AnimationMoveFrame

Use: Moves a frame to a new position in the animation.Command: Plot/Animation

Syntax: animationmoveframe “plot name” frame_number position

Note: position refers to the frame’s position in the frame list. For example:-1 = Add to end of list 0 = Add to beginning of list 1 = Add after first frame 2 = Add after second frame

Example: animationmoveframe “Animation1” 1 0

This example moves the second frame in the frame list to the beginning ofthe list in the animation plot Animation1.

AnimationPlay

Use: Plays an animation plot.Command: Plot/Animation

Syntax: animationplay “plot name” number_of_frames

Example: animationplay “magplot” 4

This example plays the next four frames of the animation named magplot.AnimationPlot

Use: Creates an animation plot with the specified name.Command: Plot/Animation

Syntax: animationplot “plot name” number_of_frames

Example: animationplot “Plot1” 10

This example creates a 10-frame animation plot called Plot1.AnimationSaveFrames

Use: Saves the frame of the selected animation to files with the given filenameprefix.

Command: none

Syntax: animationsaveframes “plot name” “file’s base name”“format”

Note: format: bmp, gif, pict, tiff, or sgiExample: animationsaveframes “mag H” “antenna” “gif”

This example saves the magnetic field frames for the antenna file in .gifformat.

Page 181: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-31

AnimationSavePlot

Use: Saves the contents of the selected animation to a file. AVI output isavailable only on the PC.

Command: none

Syntax: animationsaveplot “plot name” “filename” “format”delay greyscale [image_size] loops brightness contrast“avi compression” avi_compression_factor

Note: format: GIF or AVIdelay: time delay between frames, in seconds.greyscale: 0 for no, 1 for yes.image_size: [xval, yval]. Defaults to [0,0].loops: number of loops in the animation.brightness: the brightness from -0.5 to 0.5. Defaults to 0.contrast: 0.5 to 2.avi_compression: None, Inelindeo, Cinepak, MSVideo.avi_compression_factor: 0 to 100. Default is 50.

Example: animationsaveplot “magH” “antenna” “avi” 3 0 [100,100]8 0 0 none 65

This example saves the magH for the antenna file as an AVI file whoseframes are spaced at 3-second intervals. The image size is 100x100 in fullcolor, with no compression or adjustments to the contrast or brightness.

AnimationSetDeltaVal

Use: Sets the value by which the animation variable changes between eachframe of animation. Use this command in conjunction withAnimationSetStartVal and AnimationSetStopVal.

Command: none

Syntax: animationsetdeltaval value

AnimationSetPlayTime

Use: Plays the animation for the specified time, in milliseconds.Command: none

Syntax: animationsetplaytime time

AnimationSetRefinement

Use: Sets the refinement value for animation plots.Command: none

Syntax: animationsetrefinement level

Note: level: 0 to 2

Page 182: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-32 Post Processor Script Commands

AnimationSetStartVal

Use: Sets the value at which the animation variable starts.Command: none

Syntax: animationsetstartval value

AnimationSetStopVal

Use: Sets the value at which the animation variable stops.Command: none

Syntax: animationsetstopval value

AnimationSetStoreFrame

Use: Sets whether you want to store the frames in memory for later use.Command: none

Syntax: animationsetstoreframe store_frames

Note: store_frames: 0 for no, 1 for yes.AnimationSetVarName

Use: Sets the variable to vary to create an animation plot.Command: none

Syntax: animationsetvarname “variable name”

Example: animationsetvarname “PHASE”

This example creates an animation plot by varying the phase of theselected quantity.

AnimationShowFrame

Use: Displays the specified frame of an animation plot.Command: Plot/Animation

Syntax: animationshowframe “plot name” frame_number

Page 183: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-33

ArcCreate

Use: Defines an arc geometry.Command: Geometry/Create/Arc

Syntax: arccreate [center] arc_axis radius <radius vector>clockwise “angle/end_pos” segments “object name”

Note: center: [xval, yval, zval]arc_axis: 0 for X, 1 for Y, 2 for Z.radius_vector: <xval, yval, zval>clockwise: 0 for counterclockwise, 1 for clockwise.angle/end_pos: angle or end position.

Example: arccreate [0,0,0] 0 10 <50,50,0> 1 “angle” 15 “arc1”

This example creates a clockwise arc named arc1 from the origin to[50,50,0] with 15 segments.

AtPhase

Use: Takes the given complex quantity, rotates it by a user-specified angle,and takes the real part. If the complex quantity is a vector, the operation isperformed on each component. The angle must be at the top of the stack.

Command: Field Calculator

Syntax: atphase

BHPlot

Use: Plots the BH-curve for an object with nonlinear materials.Command: none

Syntax: bhplot “object name”

BuildPlotInfo

Use: Updates plots on the specified geometry.Command: none

Syntax: buildplotinfo “geometry name”

Example: buildplotinfo “faces1”

This updates the plot on the faces list faces1.Clear

Use: Clears the stack contents in the Field Calculator.Command: Field Calculator

Syntax: clear

Page 184: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-34 Post Processor Script Commands

CmplxI

Use: Makes a scalar or vector into a complex quantity using the scalar orvector as the imaginary part.

Command: Field Calculator

Syntax: cmplxi

CmplxMag

Use: Calculates the complex magnitude of the top register of the stack.Command: Field Calculator

Syntax: cmplxmag

CmplxR

Use: Makes a scalar or vector into a complex quantity using the scalar orvector in the top register as the real part.

Command: Field Calculator

Syntax: cmplxr

Conj

Use: Calculates the conjugate of the top register of the stack.Command: Field Calculator

Syntax: conj

CreateAnimation

Use: Creates a new animation plot with a default name.Command: Plot/Animation

Syntax: createanimation number_of_frames

CreateBHPlot

Use: Plots the BH-curves for all objects in the model.Command: none

Syntax: createbhplot

CreateFacesList

Use: Creates a list of faces. Use the AddFaceWithId command to add faces tothe list.

Command: Geometry/Create/Faces List

Syntax: createfaceslist

CreatePlot

Use: Creates a new field plot.Command: Plot/Field

Syntax: createplot

Page 185: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-35

Cross

Use: Calculates the cross product of the top two registers of the stack.Command: Field Calculator

Syntax: cross

Curl

Use: Calculates the curl of the top register of the stack.Command: Field Calculator

Syntax: curl

CutPlaneCreate

Use: Creates a cutplane. Use ModifyCutPlane and DeltaModifyCutPlane todefine the geometry of the cutplane.

Command: Geometry/Create/Cutplane

Syntax: cutplanecreate

CutPlaneModify

Use: Modifies cutplane definitions.Command: Geometry/Modify/Cutplane

Syntax: cutplanemodify

D/Dx

Use: Calculates the derivative of the top register with respect to x.Command: Field Calculator

Syntax: d/dx

D/Dy

Use: Calculates the derivative of the top register with respect to y.Command: Field Calculator

Syntax: d/dy

D/Dz

Use: Calculates the derivative of the top register with respect to z.Command: Field Calculator

Syntax: d/dz

DefineCutPlane

Use: Defines a cutplane geometry.Command: none

Syntax: definecutplane “plane name” [position] <normal>

Example: definecutplane “plane1” [0,0,0] <0,0,10>

This example defines the cutplane named plane1 whose position rests atthe origin and whose normal plane extends from [0,0,10].

Page 186: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-36 Post Processor Script Commands

DefineExternalFace

Use: Creates a list of surfaces from the object or object list you specify.Command: Geometry/Create/Surface List

Syntax: defineexternalface “plane name” “object/list name”

Example: DefineExternalFace “surf1” “obj1”

This example defines the faces of obj1 as the surface list surf1.DefineFacesList

Use: Creates an object list. Add faces to the list using the AddFaceWithId orAddFaceAtPos commands.

Command: none

Syntax: definefaceslist “list name”

DefineFunction

Use: Defines a function. The new function is listed in the Functions table.Command: none

Syntax: definefunction “function definition”

Example: definefunction “f=sin(x)”

This example defines f as sin(x).DefineObjectList

Use: Creates an object list. Add objects to the list using the AddObjectToListcommand.

Command: none

Syntax: defineobjectlist “list name”

DefinePoint

Use: Defines a point.Command: none

Syntax: definepoint “name” [px,py,pz]

Example: DefinePoint “pointsource“ [100,50,50]

This example defines a point named pointsource at [100,50,50].DeleteLine

Use: Deletes a line.Command: none

Syntax: deleteline “name”

DeletePlot

Use: Deletes an existing plot.Command: none

Syntax: deleteplot “plot name”

Page 187: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-37

DeletePoint

Use: Deletes a point.Command: none

Syntax: deletepoint “name”

DeleteSurface

Use: Deletes a surface geometry.Command: none

Syntax: deletesurface “name”

DeleteVolume

Use: Deletes a volume geometry.Command: none

Syntax: deletevolume “name”

DeltaModifyCutPlane

Use: Changes the cutplane’s origin by an incremental position.Command: Geometry/Create/Cutplane

Syntax: deltamodifycutplane “name” [incremental position]<normal>

Example: deltamodifycutplane “plane1” [0,0,1] <0,0,20>

This example modifies the origin of the cutplane plane1 by one unit in thepositive z-direction. If the origin had been at [0,0,2] it would now be at[0,0,3]. The normal of the plane is <0,0,20>.

DeltaModifyPoint

Use: Changes the point’s position by an incremental position.Command: Geometry/Create/Point

Syntax: deltamodifypoint “name” [px,py,pz]

Example: deltamodifypoint “point1” [0,0,1]

This example moves the point point1 by one unit in the positive z-direc-tion. If the point had been at [0,0,2] it would now be at [0,0,3].

Divg

Use: Calculates the divergence of the top of the stack.Command: Field Calculator

Syntax: divg

Page 188: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-38 Post Processor Script Commands

Domain

Use: Restricts a field quantity to a volume. The two top entries of the stackmust be a volume geometry and numeric quantity. The volume must beon the top of the stack

Command: Field Calculator

Syntax: domain

Dot

Use: Calculates the dot product of the top two stack registers.Command: Field Calculator

Syntax: dot

Draw

Use: Opens a drawing window, which allows you to draw a geometry (onlylines and surfaces) from the top stack register.

Command: Field Calculator

Syntax: draw

DrawLine

Use: Draws the line contained in the top register of the stack. This command islike the Draw command, except it does not access the Line Drawingwindow.

Command: Field Calculator

Syntax: drawline “plot name”

DrawSurface

Use: Creates a plot of a surface.Command: Field Calculator

Syntax: drawsurface “plot name”

DrawVolume

Use: Creates a volume box.Command: Field Calculator

Syntax: drawvolume “plot name”

Enter

Use: Enters a solved field quantity in the top register of the stack.Command: Field Calculator

Syntax: enter “quantity name”

Example: enter “E”

This example enters the complex E-field vector in the top register of thestack.

Page 189: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-39

EnterComplex

Use: Enters a complex constant in the top register of the stack. The quantitymust be in the form [Real, Imag].

Command: Field Calculator

Syntax: entercomplex [real, imaginary]

EnterComplexVector

Use: Enters a complex vector quantity. Enter the real and imaginary parts foreach component of the vector.

Command: Field Calculator

Syntax: entercomplexvector [x_real, x_imag] [y_real, y_imag][z_real, z_imag]

EnterFrequency

Use: Enters the frequency that is currently being used in the top register of thestack.

Command: Field Calculator

Syntax: enterfrequency

EnterLine

Use: Enters a line with the specified name in the top register of the stack.Command: Field Calculator

Syntax: enterline “name”

EnterPoint

Use: Enters a 3D point in the top register of the stack.Command: Field Calculator

Syntax: enterpoint “name”

EnterScalar

Use: Enters a scalar constant in the top register of the stack.Command: Field Calculator

Syntax: enterscalar value

EnterScalarFunction

Use: Enters a scalar function in the top register of the stack.Command: Field Calculator

Syntax: enterscalarfunction “function name”

EnterSurface

Use: Enters a surface in the top register of the stack.Command: Field Calculator

Syntax: entersurface “name”

Page 190: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-40 Post Processor Script Commands

EnterVector

Use: Enters a vector constant in the top register of the stack.Command: Field Calculator

Syntax: entervector <x,y,z>

EnterVectorFunction

Use: Enters a vector function in the top register of the stack. The functions donot have to be defined at the time they are entered, but must be definedby the time they are used.

Command: Field Calculator

Syntax: entervectorfunction “x function” “y function” “z function”

Example: entervectorfunction “PHI” “YPOS” “XANGLE”

This example enters the vector function <PHI, YPOS, XANGLE> on thecalculator stack.

EnterVolume

Use: Enters a volume in the top register of the stack.Command: Field Calculator

Syntax: entervolume “name”

Evaluate

Use: Evaluates the operation in the top register of the stack.Command: Field Calculator

Syntax: evaluate

Exchange

Use: Exchanges the top two stack entries in the 3D Post Processor FieldCalculator. For example, if the top entry in the stack is a vector quantityand the second entry is a scalar quantity, this command exchanges thosetwo values so the top entry is now a scalar quantity and the second entryis a vector quantity.

Command: Field Calculator

Syntax: exchange

ExportToFile

Use: Exports the field quantity in the top register to a file, mapping it to a gridof points. Use this command to save field quantities in a format that canbe read by other modeling or post-processing software packages. Beforeusing this command, you must create a file containing the points.

Command: Field Calculator

Syntax: exporttofile “points file name” “export file name”

Page 191: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-41

ExportToVolumeGrid

Use: Exports field values to locations on a grid.Command: Field Calculator

Syntax: exporttovolumegrid [base vertex] [box size] [gridsize] “export file name”

Example: exporttovolumegrid [-10,-10,-10] [20,20,20] [5,5,5]export1.dat

This example creates a 20x20x20 box that starts at the point [-10,-10,-10]and has grid points every 5 units. The values are saved in the fileeport1.dat.

FacesListModify

Use: Allows you to modify any faces list. Add faces to or remove faces fromthe list using the AddFaceWithId or RemoveFaceWithId commands.

Command: Geometry/Modify/Faces List

Syntax: faceslistmodify

FunctionValue

Use: Returns the value of the specified function.Command: none

Syntax: functionvalue “name of function”

GetTopEntryValue

Use: Returns the value of the top register of the stack. The top register must bea constant and should be a real scalar or real vector. This information canthen be saved to a file or assigned to variables and used by other scriptcommands.

Command: Field Calculator

Syntax: gettopentryvalue

Grad

Use: Calculates the gradient of the top register of the stack.Command: Field Calculator

Syntax: grad

Imag

Use: Calculates the imaginary part of the top register of the stack.Command: Field Calculator

Syntax: imag

Page 192: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-42 Post Processor Script Commands

Integrate

Use: Integrates a field on a geometry. The contents of the top two registers ofthe stack need to be a geometry (other than a point or volume box)followed by a scalar.

Command: Field Calculator

Syntax: integrate

IsoSurface

Use: Generates an iso-value surface of the field.Command: Field Calculator

Syntax: isosurface

LineCreate

Use: Creates a polyline. Use the EditPline commands to create the points onthe line.

Command: Geometry/Create/Line

Syntax: linecreate

LineModify

Use: Selects a line for modification. After the line is selected, use the EditPlinecommands to modify the line.

Command: Geometry/Modify/Line

Syntax: linemodify “line to modify”

LinePlot

Use: Creates a 3D line plot from the contents of the top two registers of thestack. The top of the stack must be a line geometry followed by a scalarquantity. Note that when you select a quantity and a surface using Plot/Field, they are loaded into the Field Calculator.

Command: Plot/Field

Syntax: lineplot “plot name”

Page 193: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-43

LinePlot2D

Use: Creates a 2D line plot from the contents of the top two registers of thestack. The top of the stack must be a line geometry followed by a scalarquantity.

Command: Plot/Field, Field Calculator

Syntax: lineplot “plot name” color width marker_styleline_style draw_marker? draw_line? new_window?

Note: color: Select a value between 0 and 255.width: The higher the number the thicker the line.marker_style: Select from the following types.

line_style: Select from the following types.

draw_marker?: 0=No Markers, 1=Draw Markersdraw_line?: 0=No lines, 1=Draw linesnew_window?: 0=Add to current window, 1=New window

Example: lineplot2d “graph2” 11 1 0 1 0 1 1

This example creates a plot called graph2 in a new window. The graphuses thin, solid lines and does not have any markers displayed.

LineRecalculate

Use: Updates all plots that depend on the line that is currently being modified.Command: Geometry/Modify/Line

Syntax: linerecalculate

Type Marker Type Marker

0 no marker 6 Triangle

1 . 7 Circle

2 x 8 Solid Square

3 + 9 Solid Diamond

4 Square 10 Solid Triangle

5 Diamond 11 Solid Circle

Style Line Form

1 Solid line.

2 Dashed line.

3 Dotted line.

4 Dash-dot line.

5 Dash-dot-dot line.

Page 194: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-44 Post Processor Script Commands

Ln

Use: Takes the logarithm of the top of the stack.Command: Field Calculator

Syntax: ln

Load2DPlot

Use: Reads in a 2D plot (.dat file).Command: Plot/Open/2D Plot

Syntax: load2dplot “file name”

LoadPlot

Use: Reads in a 3D plot (.dsp file).Command: Plot/Open/3D Plot

Syntax: loadplot “filename”

LockCutPlaneNormal

Use: Locks and unlocks the normal for a cutplane. Locked geometries cannotbe modified.

Command: none

Syntax: lockcutplanenormal “plane name” lock

Note: lock: 0=Unlocked, 1=LockedLockCutPlaneOrigin

Use: Locks and unlocks the origin of a cutplane. Locked geometries cannot bemodified.

Command: none

Syntax: lockcutplaneorigin “plane name” lock

Note: lock: 0=Unlocked, 1=LockedLockVolume

Use: Locks and unlocks the geometry. Locked geometries cannot be modified.Command: none

Syntax: lockvolume “volume name” lock

Note: lock: 0=Unlocked, 1=LockedLog

Use: Takes the log base 10 value of the top register of the calculator stack.Command: Field Calculator

Syntax: log

Page 195: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-45

Mag

Use: Computes the magnitude of the top of the stack.Command: Field Calculator

Syntax: mag

Material

Use: Multiplies or divides the vector in the top of the stack by the selectedmaterial property. At each tetrahedron, the field quantity is multiplied ordivided by the value of the selected material property — taking thedifferent material attributes of each object into account.

Command: Field Calculator

Syntax: material “material” “operation”

Note: material: mu, epsi, omega, condoperation: mult=multiply, divd=divide

Example: material “mu” “mult”

This example multiplies the vector in the top of the stack by the perme-ability.

MathFunc

Use: Evaluates the specified function using the value in the top of the stack asthe operand.

Command: Field Calculator

Syntax: mathfunc “function”

Note: The following functions are available:SinCosTanAsinAcosAtanAtan2

Example: mathfunc “Sin”

This example takes the sine of the quantity in the top of the stack.Maximum

Use: Finds the maximum value of a field in a geometry. The top of the stackmust be a geometry (other than a point) followed by a numeric quantity.

Command: Field Calculator

Syntax: maximum

Page 196: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-46 Post Processor Script Commands

MaxPos

Use: Finds the position in a geometry where the field is at a maximum. The topof the stack must be a geometry (other than a point) followed by anumeric quantity.

Command: Field Calculator

Syntax: maxpos

Minimum

Use: Finds the minimum value of a scalar field in a geometry. The top of thestack must be a geometry (other than a point) followed by a numericquantity.

Command: Field Calculator

Syntax: minimum

MinPos

Use: Finds the position in a geometry where the field is at a minimum. The topof the stack must be a geometry (other than a point) followed by anumeric quantity.

Command: Field Calculator

Syntax: minpos

ModelMax

Use: Displays the bounding box maximums.Command: none

Syntax: modelmax

ModelMin

Use: Displays the bounding box minimums.Command: none

Syntax: modelmin

ModifyCutPlane

Use: Sets a cutplane’s origin and normal.Command: Geometry/Create/Cutplane, Geometry/Modify/Cutplane

Syntax: modifycutplane “name” [position] <normal>

Example: modifycutplane “plane1” [0,0,0] <0,0,1>

This example sets the origin of the cutplane plane1 to [0,0,0] and its nor-mal to the [0,0,1].

Page 197: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-47

ModifyPlot

Use: Allows you to modify an existing plot from the window that appears. Thewindow that appears depends on the type of plot.

Command: Plot/Modify

Syntax: modifyplot “plot name”

ModifyPoint

Use: Changes the position of a point.Command: Geometry/Create/Point, Geometry/Modify/Point

Syntax: modifypoint “point name” [x,y,z]

Example: modifypoint “point1” [1,0,10]

This example changes the position of the point point1 to [1,0,10].Neg

Use: Takes the negative of the value in the top register of the stack.Command: Field Calculator

Syntax: neg

Normal

Use: Returns the unit vector normal to the surface in the top register of thestack.

Command: Field Calculator

Syntax: normal

NormalComponent

Use: Computes the normal component of a vector quantity on a surface suchas a cutplane or object surface. This is the equivalent of taking the dotproduct of the quantity with the surface’s unit normal vector.

Command: Field Calculator

Syntax: normalcomponent

ObjectListCreate

Use: Displays a window which allows you to create an object list.Command: Geometry/Create/Object List

Syntax: objectlistcreate

ObjectListModify

Use: Displays a window which allows you to modify object lists.Command: Geometry/Modify/Object List

Syntax: objectlistmodify

Page 198: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-48 Post Processor Script Commands

OrphanPlots

Use: Makes all plots independent of the geometry on which they were createdand the numeric quantity they display.

Command: none

Syntax: orphanplots

Phase

Use: Calculates the phase of the top register of the stack.Command: Field Calculator

Syntax: phase

Plot

Use: Plots the field (second item on the stack) on a geometry (top of the stack).Command: Field Calculator

Syntax: plot

PlotMesh

Use: Draws a mesh for the current selection.Command: Plot/Mesh

Syntax: plotmesh

PlotModifyFunction

Use: Adds, updates, or deletes a function.Command: Functions

Syntax: plotmodifyfunction operation “function name” “functionexpression”

Note: operation: 0=add/update, 1=deleteExample: plotmodifyfunction 0 “Mat1” “X+5”

This example adds the new function Mat1 and defines it as X+5.PointCreate

Use: Displays a window which allows you to create a point.Command: Geometry/Create/Point

Syntax: pointcreate

PointModify

Use: Displays a window which allows you to modify points.Command: Geometry/Modify/Point

Syntax: pointmodify

Page 199: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-49

PointValuePlot

Use: Creates a point value plot.Command: Field Calculator, Plot/Field

Syntax: pointvalueplot “plot name”

Pop

Use: Deletes the top register of the stack.Command: Field Calculator

Syntax: pop

Pow

Use: Calculates the power of the top two stack contents. The number in the topregister is raised to the number in the second register of the stack.

Command: Field Calculator

Syntax: pow

Push

Use: Duplicates the top register of the stack.Command: Field Calculator

Syntax: push

ReadSolutions

Use: Reads a register into the calculator from a disk file.Command: Field Calculator

Syntax: readsolutions “file name”

Real

Use: Calculates the real part of the top register of the stack.Command: Field Calculator

Syntax: real

RemoveFaceAtPos

Use: Removes an object face at the specified position from a faces list.Command: none

Syntax: removefaceatpos “list name” “object name” [position]

Example: removefaceatpos “faces1” “abc” [10,2,5]

This example removes the face at [10,2,5] of the object abc from the faceslist faces1.

Page 200: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-50 Post Processor Script Commands

RemoveFaceWithId

Use: Removes a face with the specified ID from a faces list.Command: Geometry/Create/Faces List, Geometry/Modify/Faces List

Syntax: removefacewithid “face list” “object” id

Example: removefacewithid “faces1” “abc” 1

This example removes the face with the ID number 1 from the faces listfaces1. The face is removed from the object abc. The face ID number isunique for every face in the model, the number begins at one for the firstobject listed and increases with each following object. For example, if youcreate two boxes, the first box in the list would have faces 1-6, and the sec-ond box in the list would have faces 7-12.

RemoveObjectFromList

Use: Removes an object from a list.Command: Geometry/Create/Object List, Geometry/Modify/Object List

Syntax: removeobjectfromlist “list name” “object name”

RenameEntry

Use: Renames the top of the stack.Command: Field Calculator

Syntax: renameentry “new name”

RenameLine

Use: Renames a polyline.Command: none

Syntax: renameline “polyline name” “new name”

RenamePlot

Use: Renames a plot.Command: none

Syntax: renameplot “plot name” “new name”

RenamePoint

Use: Renames a point.Command: none

Syntax: renameplot “point name” “new name”

RenameSurface

Use: Renames a surface geometry.Command: none

Syntax: renamesurface “surface name” “new name”

Page 201: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-51

RenameVolume

Use: Renames a volume geometry.Command: none

Syntax: renamevolume “volume name” “new name”

RollDn

Use: Rolls the bottom register to the top of the stack, moving the otherregisters down the stack.

Command: Field Calculator

Syntax: rolldn

RollUp

Use: Rolls the top register to the bottom of the stack, moving the otherregisters up the stack.

Command: Field Calculator

Syntax: rollup

Save2DPlot

Use: Saves a 2D plot to a .dat file.Command: Plot/Save As/2D Plot

Syntax: save2dplot “filename”

SavePlot

Use: Saves a 3D plot to a .dsp file.Command: Plot/Save As/3D Plot

Syntax: saveplot “plotname” “filename” binary

Note: binary = 0 (save in binary format) or 1 (do not save in binary format)Example: saveplot “plot1” “magplots” 0

This example saves plot1 in the magplots.dsp file in binary format.ScalarX

Use: Converts a vector to a scalar, using the x-component only.Command: Field Calculator

Syntax: scalarx

ScalarY

Use: Converts a vector to a scalar, using the y-component only.Command: Field Calculator

Syntax: scalary

Page 202: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-52 Post Processor Script Commands

ScalarZ

Use: Converts a vector to a scalar, using the z-component only.Command: Field Calculator

Syntax: scalarz

SetArrow

Use: Sets up arrow attributes.Command: none

Syntax: setarrow type map_size? map_color? size

Note: type: 0=2D, 1=3Dmap_size: 0=Off, 1=Onmap_color: 0=Off, 1=On

SetColormap

Use: Selects the color to use for the plot.Command: none

Syntax: setcolormap color

Note: Enter one of the following color parameters:

SetFilled

Use: Displays the graph as a shaded graph or a contour graph. Use this inconjunction with the SetPlotAttributes and UpdatePlots commands.

Command: none

Syntax: setfilled filled?

Note: filled?: 0=Contour, 1=ShadedExample: setfilled 1

This example displays the graph as a shaded graph.

Parameter Color

0 Spectrum, Rainbow

1 Spectrum, Temperature

2 Spectrum, Magenta

3 Spectrum, Grayscale

8-23 Ramp color. The numbering begins in theupper left corner of the color map square andcounts down each column.

Page 203: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-53

SetGridSpacing

Use: Sets up grid spacing. Use this in conjunction with the SetPlotAttributesand UpdatePlots commands.

Command: none

Syntax: setgridspacing spacing

Example: setgridspacing 2

This example sets the space between grid points to 2.SetHiddenLine

Use: Toggles between two types of wire frame view. One view allows you tosee the wire frame lines of every tetrahedron. The second view allowsyou to see only the wire frame lines of the tetrahedra on top. In otherwords, if a tetrahedron is “behind” another tetrahedron, it is not visible.Use this in conjunction with the SetPlotAttributes and UpdatePlotscommands.

Command: none

Syntax: sethiddenline toggle

Note: toggle: 0=All lines visible, 1=Hidden lines invisibleExample: sethiddenline 0

This example sets the view to one in which all lines are visible.

SetLine

Use: Sets up line attributes.Command: none

Syntax: setline width line_style

Note: width: The higher the number the thicker the line.line_style:

☞Note: To set the view to a shaded one, use the SetFilled command.

Style Line Form

1 Solid line.

2 Dashed line.

3 Dotted line.

4 Dash-dot line.

5 Dash-dot-dot line.

Page 204: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-54 Post Processor Script Commands

SetMarker

Use: Sets up a scalar marker.Command: none

Syntax: setmarker marker_style map_size map_color size

Note: marker_style: Select from the following types.

map_size: 0=Off, 1=Onmap_color: 0=Off, 1=Onmap_color: Enter one of the following parameters.

SetMeshExternal

Use: Selects whether tetrahedra are drawn on the surface of objects or insidethe objects.

Command: none

Syntax: setmeshexternal toggle

Note: toggle: 0=Inside object, 1=Object surfaces onlyExample: setmeshexternal 1

This example displays the mesh tetrahedra only on the surfaces of objects.

Type Marker

10 Sphere

11 Box

12 Tetrahedron

13 Octahedron

Parameter Color

0 Spectrum, Rainbow

1 Spectrum, Temperature

2 Spectrum, Magenta

3 Spectrum, Grayscale

8-23 Ramp color. The numbering begins in theupper left corner of the color map squareand counts down each column.

Page 205: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-55

SetMeshScale

Use: Sets the percentage of their original size at which mesh tetrahedra aredrawn.

Command: none

Syntax: setmeshscale scale_factor

Example: setmeshscale 80

This example draws the tetrahedra at 80% of their original size.SetNumPoints

Use: Sets up the number of points for line plots.Command: Geometry/Create/Line, Geometry/Modify/Line

Syntax: setnumpoints number

SetPlotAttributes

Use: Updates the plot attributes to the current settings. Use this commandafter setting the attributes and before updating the plot with UpdatePlots.

Command: none

Syntax: setplotattributes “plot name”

SetRefinement

Use: Sets refinement levels for plots, providing a smoother variation of colors.Command: none

Syntax: setrefinement level

Note: level: 0=Low, 1=Medium, 2=HighSetScale

Use: Sets up a plot scale.Command: none

Syntax: setscale autoscale? min max levels log?

Note: autoscale: 0=Use manual scale, 1=Use autoscalelog: 0=Linear, 1=Logarithmic

Example: setscale 0 0 10 12 0

This example creates a linear plot scale whose values range between 0and 10 units with 12 divisions.

Page 206: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-56 Post Processor Script Commands

SetTextMarker

Use: Selects text or markers for point value plots. If you select text, the value ofthe field at that point is displayed.

Command: none

Syntax: settextmarker show_text?

Note: show_text: 0=User markers, 1=Show textExample: settextmarker 1

This example toggles markers to be the display type. Use the SetMarkercommand to set the marker parameters.

SetTransparency

Use: Sets the transparency percentage (0-100). This determines whether plotsor items behind the mesh are visible. A transparency of 0% creates acompletely opaque display; a transparency of 100% creates a completelytransparent display.

Command: Plot/Mesh

Syntax: settransparency percentage

ShowColorKey

Use: Shows or hides the color key for a plot.Command: none

Syntax: showcolorkey “plot name” show_flag?

Note: show_flag: 0=Hide color key, 1=Show color keySmooth

Use: Smooths the data in the top register of the stack.Command: Field Calculator

Syntax: smooth

SolutionName

Use: Returns the name of the solution file.Command: none

Syntax: solutionname

Sqrt

Use: Compute the square root of the top register of the stack.Command: Field Calculator

Syntax: sqrt

Page 207: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-57

StoreComputations

Use: Stores the values in the top register of the stack in memory for later use.Command: Field Calculator

Syntax: storecomputations store

Note: store: 0=No, 1=Yes (store)SurfacePlot

Use: Creates a surface plot from the contents of the top two registers of thestack. The top register must be a surface geometry, and the next registermust be scalar quantity. Note that when you select a quantity and asurface using Plot/Field, they are loaded into the Field Calculator.

Command: Plot/Field

Syntax: surfaceplot “plot name”

Tangent

Use: Returns the unit vector tangential to the line in the top register of thestack.

Command: Field Calculator

Syntax: tangent

TangentComponent

Use: Computes the tangential component of a vector along a line.Command: Field Calculator

Syntax: tangentcomponent

Top

Use: Displays the top register of the stack.Command: Field Calculator

Syntax: top

Undo

Use: Undoes the previous operations. Replaces the top of the stack with itscomponents in the Field Calculator.

Command: Field Calculator

Syntax: undo number_of_steps

UpdatePlots

Use: Refreshes all plots, regenerating those that were modified.Command: none

Syntax: updateplots

Page 208: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-58 Post Processor Script Commands

Value

Use: Evaluates the value of the stack at a specified point. The top register mustbe a geometry, and the next register must be a numeric quantity.

Command: Field Calculator

Syntax: value

VecX

Use: Converts a scalar value to a vector using only the x-component.Command: Field Calculator

Syntax: vecx

VecY

Use: Converts a scalar value to a vector using only the y-component.Command: Field Calculator

Syntax: vecy

VecZ

Use: Converts a scalar value to a vector using only the z-component.Command: Field Calculator

Syntax: vecz

VolumeBoxCreate

Use: Defines a volume box geometry.Command: Geometry/Create/Volume Box

Syntax: volumeboxcreate [base vertex] size_x size_y size_z“object name”

Example: volumeboxcreate [0,0,0] 10 10 10 “lgbox”

This example creates a 10x10x10 box, lgbox, whose base vertex is at theorigin.

VolumePlot

Use: Creates a volume plot from the top two contents of the calculator stack.The top two entries of the stack must be a volume geometry followed by ascalar quantity. Note that when you select a quantity and a volume usingPlot/Field, they are loaded into the Field Calculator.

Command: Plot/Field

Syntax: surfaceplot “plot name”

WriteSolutions

Use: Writes field values to a file.Command: Field Calculator

Syntax: writesolutions “file name”

Page 209: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-59

Array Factor CalculationAnsoft HFSS has five specialized script commands in the Post Processor thatallow you to compute antenna array patterns from projects in which a singleelement has been analyzed. Although intended mainly for computing finite-array patterns from infinite-array, unit-cell analyses, these script commandsmay be useful in other array contexts.

Theory

The composite far-field pattern, Earray (θ, φ) from an array of N identical radi-ating sources, each with far-field pattern Eelement (θ, φ), may be factored intothe form:

where the “array factor” AF(θ, φ) is defined:

and:● (θ, φ) are the field point spherical coordinate angles relative to the global

coordinate system.● Wn is the complex weight assigned to element n.● k is 2π/λ.● rn is the global position vector of element n, <xn, yn, zn>.● is the unit vector that points from the origin to the far-field point,

<sinθcosφ, sinθsinφ, cosθ>.In what follows, we restrict consideration to uniform arrays, in which theamplitude of Wn is 1. To scan the array in the direction (θ0, φ0), the complexweights Wn are set:

where is the scan angle unit vector <sinθ0cosφ0, sinθ0, cosθ0>. The arrayfactor expression (2) becomes:

(1)

(2)

(3)

(4)

Earray θ φ( , ) AF θ φ( , )Eelement θ φ( , )=

AF θ φ( , ) Wnejkrn r̂⋅

n 1=

N

∑=

Wn ej– krn r̂0⋅

=

r0ˆ

AF θ φ( , ) ejkrn r̂ r̂0–( )⋅

n 1=

N

∑=

Page 210: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-60 Post Processor Script Commands

For a regular array with spacing defined by lattice vectors u and v, the ele-ment position vectors may be written in the doubly indexed form:

with n = 1, 2, ...., N and m = 1, 2, ..., M and the total number of elements equalsMN.The array factor (4) for the M x N array becomes:

and using the expression for rmn, this may be factored into the form:

where:

and:

When the array factor feature is in use, the power normalizations used tocompute the gain and directivity are modified as follows.

Let and denote the radiated power and the accepted powerof the single element where:

● is computed by integrating the Poynting vector on the radiationboundary surface.

● is computed from the element S-parameters.

For an array of N elements, the array radiated power and arrayaccepted power are computed simply as the sums of elementradiated and element accepted powers respectively:

(10)

(11)

(5)

(6)

(7)

(8)

(9)

rmn m 1–( )u n 1–( )v+=

AF θ φ( , ) ejkrmn r̂ r̂0–( )⋅

n 1=

N

∑m 1=

M

∑=

AF θ φ( , ) ej M 1–( )

ψu

2------

ej N 1–( )

ψv

2------ Mψusin 2⁄

ψusin 2⁄---------------------------

Nψvsin 2⁄ψvsin 2⁄

--------------------------=

ψu ku r̂ r̂0–( )⋅=

ψv kv r̂ r̂0–( )⋅=

P elementrad

P elementaccepted

P elementrad

P elementaccepted

P arrayrad

P arrayaccepted

P arrayrad NP

element

rad=

P arrayaccepted NP

element

accepted=

Page 211: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-61

Note that the array power expressions (10) and (11) completely neglectmutual coupling between elements of the finite array. Unless mutual cou-pling effects are negligible or have been implicitly included in the single ele-ment solution using linked boundary conditions, the normalizations for gainand directivity will be incorrect. However, the shape of the radiation patterndistribution will not be affected.

Array Factor Script Commands

The following script commands are available in the Post Processor and allowyou to compute antenna array patterns.

GetArrayData

Use: Displays information regarding the cells of the finite array.Command: none

Syntax: getarraydata

SetArrayCalculation

Use: Toggles the array factor on or off. If the array factor is on, each time aradiated field value is computed the array factor is included as amultiplier in the manner of equation (1). Before you can toggle the arrayfactor on, you must compute the array factor using the other array factorscript commands.

Command: none

Syntax: setarraycalculation on_off

Note: on_off: 1=On, 0=OffSetArrayScanAngle

Use: Defines the scan angle (φ0, θ0). Enter φ0 and θ0 in degrees.Command: none

Syntax: setarrayscanangle phi theta

☞Note: After toggling SetArrayCalculation on and computing the fields, toggling it

off does not recalculate the fields. If you want to view the fields without thearray calculation, toggle it off and recompute the fields.

Page 212: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

10-62 Post Processor Script Commands

SetCustomArrayGeom

Use: Imports the element positions from the specified file. Once theinformation is imported, the software uses equation (4) to compute thearray factor. The text file containing the element positions must have thefollowing format:

N

x_1 y_1 z_1

x_2 y_2 z_2

...

x_N y_N z_N

Command: none

Syntax: setcustomarraygeom “file name”

Example: setcustomarraygeom “elements.udb”

where elements.udb is:9

0.0 0.0 0.00.6729 0.0 0.01.3458 0.0 0.00.0 0.6729 0.00.6729 0.6729 0.01.3458 0.6729 0.00.0 1.3458 0.00.6729 1.3458 0.01.3458 1.3458 0.0

This example defines a square 3 x 3 array. The array elements are sepa-rated from one another in the global x- and y-directions by 0.6729 userunits.

Page 213: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Command Sets

Post Processor Script Commands 10-63

SetRegularArrayGeom

Use: From the information specified for this script command, the softwaregenerates a solution for the array factor given in equation (6) defined inthe previous section.

Command: none

Syntax: setregulararraygeom num_u_unit_cells num_v_unit_cellsdist_btw_u_cells dist_btw_v_cells <u direction vector><v direction vector> [first cell position]

Note: num_u_unit_cells: The number of unit cells in the U-direction.num_v_unit_cells: The number of unit cells in the V-direction.dist_btw_u_cells: The distance between cells in the U-direction, inuser units.dist_btw_v_cells: The distance between cells in the V-direction, inuser units.<u direction vector>: The vector along which the cells in theU-direction are placed.<v direction vector>: The vector along which the cells in theV-direction are placed.[first cell position]: The position at which the first cell is placed.

Example: setregulararraygeom 3 3 0.6729 0.6729 <1,0,0> <0,1,0>[0,0,0]

This example defines an array identical to the one given for SetCustomAr-rayGeom.

Page 214: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Command Set

10-64 Post Processor Script Commands

Matrix Data Post Processor Command SetThe following script commands are classified as MatrixData script com-mands.

CreateSpiceExporter

Use: Defines the solution name for the exported Spice file.Command: none

Syntax: createspiceexporter “solution name”

OverrideSpiceExporterValue

Use: Rewrites the specified values in the Spice file. These values must alreadyhave been defined.

Command: none

Syntax: overridespiceexportervalue matrix_row matrix_columnfreq_index real_part_of_value imag_part_of_value

Note: matrix_row: The number of the row.matrix_column: The number of the column.freq_index: The frequency index value.real_part_of_value: The real part of the value to modify.imag_part_of_value: The imaginary part of the value to modify.

Example: OverrideSpiceExporterValue 3 5 6e6 0.5 0.67

The example overrides the values in the third row in the fifth column,and replaces the values in the Spice file with a frequency index of 6 andthe real and imaginary parts of the values as 0.5 and 0.67, respectively.

SzgDataKernelCreateSweep

Use: Combines two or more frequency sweeps into a new sweep. If thecomponent sweeps are discrete sweeps, the combined sweep will containall frequency points defined in the components. If they are interpolatingsweeps, there must be no sampling range gaps, and a compositesampling interval will be automatically chosen.

Command: Compute/Create Sweep

Syntax: szgdatakernelcreatesweep {“sweep1” “sweep2” ...}

Example: szgdatakernelcreatesweep {“S_1” “S_2”}

This example combines the first sweep, S_1, with the second sweep, S_2.

Page 215: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Command Set

Post Processor Script Commands 10-65

SzgDataKernelComputeTerminal

Use: Computes the terminal solution on the differential pairs based on thedefined impedance values.

Command: none

Syntax: szgdatakernelcomputeterminal “solution name”reference_impedance(real) reference_impedance(imag){differential pairs}

Note: differential pairs: a string list that includes all the differentialpairs in the setup.

Example: szgDatakernelcomputeterminal “termsoln” 40.0 25.5{“pair1” “pair2”}

This example generates a solution named termsoln based on the refer-ence impedance values of 40.0 (real) and 25.5 (imaginary) for the differen-tial pairs pair1 and pair2.

SzgDataKernelComputeYZ

Use: Computes the admittance or impedance matrices for the specifiedsolution.

Command: Compute/Y Matrix, Compute/Z Matrix

Syntax: szgdatakernelcomputeyz “solution name” “y or z”{ z_basis z_basis }

Note: z_basis: 5=Zpi, 6=Zpv, 7=ZviSpecify the Z_BASIS for each port/mode combination.

Example: szgdatakernelcomputeyz “S_2” “z” { 6 6 }

This example computes the impedance matrix for the frequency sweepS_2. Zpv is the impedance used when calculating the impedance matrix.

SzgDataKernelDeembed

Use: Computes the S-matrix for any structure that can be created by adding (orsubtracting) a length of transmission line to (or from) a port.

Command: Compute/De-embed

Syntax: szgdatakerneldeembed “solution1” {port1_distport2_dist ...}

Note: For the distances, a negative value indicates that the de-embedding isoutward from the object and a positive value indicates that de-embedding is inward towards the object. The distances are given inmeters.

Example: szgdatakerneldeembed “S_3” { -0.002 0.000 }

This example de-embeds the first port from the frequency solution S_3.The de-embedding is 2 mm outward from the port. The second port is notde-embedded.

Page 216: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Command Set

10-66 Post Processor Script Commands

SzgDataKernelDelete

Use: Deletes one or more solutions from the Solution list.Command: File/Delete

Syntax: szgdatakerneldelete {“solution1” “solution2” ...}

Example: szgdatakerneldelete {“A_1” “S_2”}

This example deletes the adaptive solution A_1 and the frequency sweepS_2.

SzgDataKernelExit

Use: Exits the Matrix Data Post Processor. You may elect to save your session.Command: File/Exit

Syntax: szgdatakernelexit “save/nosave”

Example: szgdatakernelexit “nosave”

This example exits the Matrix Data Post Processor without saving.SzgDataKernelExport

Use: Writes a set of matrices to a data file in the specified format.Command: File/Export

Syntax: szgdatakernelexport “solution” “format” “file name andlocation” ref_impedance

Note: format can be one of the following:citifiletouchstoneserenade or supercompactspreadsheetneutralformatterminal Z0 spreadsheet

Example: szgdatakernelexport “S_3” “citifile” “/hfss/t1.tab” 45

This example saves the matrices in the frequency sweep S_3 in table for-mat to the file t1.tab located in the directory hfss. The reference imped-ance for the output is 45 ohms.

Page 217: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Command Set

Post Processor Script Commands 10-67

SzgDataKernelImport

Use: Imports a previously saved solution file. The file must be an HFSS version6 or Maxwell Ensemble .szg format. Only S-parameter data is imported.

Command: File/Import

Syntax: szgdatakernelimport “file name and location”{“solution1” “solution2” ...}

Example: szgdatakernelimport “/hfss/cpw.szg” {“A_3” “S_1”}

This example imports the file cpw.szg from the hfss directory. A_3 and S_1are the two solutions imported from the file.

SzgDataInterpolateValue

Use: Interpolates theCommand: none

Syntax: szgdatainterpolatevalue “complex format” “solutionname” frequency “matrix data type” row_port_indexrow_mode_index col_port_index col_mode_index

Note: complex format: MP or RImatrix data type: Choose from S, Y, Z, G, Zpi, Zpv, or Zvi

Example: szgdatainterpolatevalue “RI” “termsoln” 5000000 “S”2 1 2 1

This example defines the real/imaginary S-matrix solution named term-soln which is generated at 5 MHz for the entries at row 2, column 2whose respective indices are both 1.

SzgDataIsTerminalSoln

Use: Defines the name of the terminal solution.Command: none

Syntax: szgdataisterminalsoln “solution name”

Page 218: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Command Set

10-68 Post Processor Script Commands

SzgDataKernelRenormalize

Use: Renormalizes an S-matrix to specific port impedances.Command: Compute/Renormalize

Syntax: szgdatakernelrenormalize “solution” {which_port/modes}{z_basis}{real_impedance}{imaginary_impedance}

Note: which_port/modes: 0=Don’t Renormalize, 1=RenormalizeZ_BASIS: 5=Zpi, 6=Zpv, 7=Zvi

Example: szgdatakernelrenormalize “S_3” {1 0} {5 5} {45 50}{0 0}

This example renormalizes the first port of a two-port structure from thefrequency solution S_3, using Zpi port impedance with a real value of 45ohms and an imaginary value of 0 ohms.

SzgDataKernelRenormTerminal

Use: Renormalizes the terminal solution with the defined reference impedancevalues.

Command: none

Syntax: szgdatakernelrenormterminal “solution name”reference_imped(real) reference_imped(imag)

Example: szgdatakernelrenormterminal “termsoln” 40.0 29.5

This example renormalizes the solution for termsoln with a real imped-ance value of 40.0 and an imaginary impedance value of 29.5.

☞Note: Port/mode combinations are listed in the ascending order — port1:mode1,

port1:mode2, port2:mode1, and so forth. For example, if you have twoports each with two modes (for a total of four combinations), to renormal-ize just the first mode of each port, use the following WHICH_PORT/MODESstring:{1 0 1 0}

➥Warning: Each of the double lists must contain one entry per port/mode combina-

tion. Therefore, even though you are not renormalizing the second port/mode combination, you must include a Z_BASIS, REAL_IMPEDANCE, andIMAGINARY_IMPEDANCE value for it. Otherwise the system assumes thereis missing data for the script command and returns an error.

Page 219: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Command Set

Post Processor Script Commands 10-69

SzgDataLastSolnOfType

Use: Returns the name of the last solution of the specified type.Command: none

Syntax: szgdatalastsolnoftype “type”

Note: type is one of the following:adaptsweepdeembedrenormport_onlynon_adaptsingle_freq

Page 220: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Command Set

10-70 Post Processor Script Commands

SzgDataMatrixValue

Use: Returns the matrix value from the location in the matrix you specify.Command: none

Syntax: szgdatamatrixvalue “format” “solution name”frequency_position “data type” row_port row_modecolumn_port column_mode

Note: format: MP=Magnitude/Phase, RI=Real/Imaginaryfrequency_position is the frequency value’s position in the list offrequencies. 0 indicates the top of the list, 1 is the second value, and soforth.data type: Use one of the following.

row_port: Enter the port number of the row you want.row_mode: Enter the mode number of the row you want.column_port: Enter the port number of the column you want.column_mode: Enter the mode number of the column you want.

Example: szgdatamatrixvalue “MP” “S_1” 0 “S” 1 1 1 1

This example returns the matrix value of the S-matrix calculated at thefirst frequency point in the solution S_1. The value returned is in the for-mat (magnitude, phase). The row and column numbers depend on thenumber of ports and modes in the problem. Two numbers specify therow and two numbers specify the column. The first number representsthe port and the second the port’s mode. The following matrix shows thefour coordinates that identify each S-matrix entry for a two-port problemin which the first port has one mode and the second has two.

Parameter Data Type

S S matrix

Y Y matrix

Z Z matrix

G Gamma

Zpi Zpi

Zpv Zpv

Zvi Zvi

P1:M1 P2:M1 P2:M2

P1:M1 1 1 1 1 1 1 2 1 1 1 2 2

P2:M1 2 1 1 1 2 1 2 1 2 1 2 2

P2:M2 2 2 1 1 2 2 2 1 2 2 2 2

Page 221: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Command Set

Post Processor Script Commands 10-71

SzgDataNumPortModes

Use: Returns the number of modes on the specified port. Ports startnumbering at one.

Command: none

Syntax: szgdatanumportmodes port

SzgDataNumPorts

Use: Returns the number of ports in the problem.Command: none

Syntax: szgdatanumports

SzgDataNumSolnFreqs

Use: Returns the number of frequency points for the specified solution.Command: none

Syntax: szgdatanumsolnfreqs “solution”

Example: szgdatanumsolnfreqs “S_2”

This example lists the total number of frequency points for the frequencysweep S_2.

SzgDataNumSolns

Use: Returns the number of solutions.Command: none

Syntax: szgdatanumsolns

SzgDataSave

Use: Saves the Matrix Data Post Processor information to a disk file.Command: File/Save

Syntax: szgdatasave

SzgDataSolnFreq

Use: Returns the specified frequency value in Hz for the selected solution.Command: none

Syntax: szgdatasolnfreq “solution name” frequency_position

Note: frequency_position is the frequency value’s position in the list offrequencies. 0 indicates the top of the list, 1 is the second value, and soforth.

Example: szgdatasolnfreq “S_2” 3

This example returns the value of the frequency that is fourth in the fre-quency list.

Page 222: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Command Sets

10-72 Post Processor Script Commands

SzgDataSolnName

Use: Returns the name of the specified solution. Numbering begins at zero forthe top of the list and increases down the list. There is no pre-definedordering among the solution types in the list.

Command: none

Syntax: szgdatasolnname list_position

Example: szgdatasolnname 1

This example returns the solution name for the solution occupying thesecond position in the Solutions list.

Matrix Plot Post Processor Command SetsThe following script commands are classified as MatrixPlot script commands.

SzgPlotAcceptCalcEdit

Use: Saves the current definition for the expressions you have defined.Command: Edit/Calculated Expressions

Syntax: szgplotacceptcalcedit

SzgPlotAcceptSigEdit

Use: Saves the current definition for the signals you have defined.Command: Edit/Input Signal

Syntax: szgplotacceptsigedit

Page 223: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Command Sets

Post Processor Script Commands 10-73

SzgPlotAddGraph

Use: Graphs a new quantity in an existing plot. Create the plot with theSzgPlotCreate or SzgPlotImport command. When you create or import aplot, a name is assigned to the plot and is returned to the macro, whereyou can assign it to a variable.

Command: Plot/Add To Plot

Syntax: szgplotaddgraph plot_name “solution name” “data type”“component” “signal name” “quantity”

Note: plot_name: The name of the plot. This may change as a result of addingthe graph. The new name is returned by the command.solution name: The name of the solution.data type: Use one of the following.

component: Use one of the following:

signal name: The name of the input signal used to scale the graph orthe name of the input signal you wish to plot. If you are not scaling the

Data Type Definition

S S matrix

Y Y matrix

Z Z matrix

G Gamma

Z0 Terminal Z0

Zpi Zpi

Zpv Zpv

Zvi Zvi

emissions Emissions

inputsig Input signal

magphaserealimagcomplexEtotalExEyEzEphiEtheta

Page 224: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Command Sets

10-74 Post Processor Script Commands

graph or plotting an input signal, leave the Signal name blank.quantity: Use one of the following:

Example: szgplotaddgraph “Plot 1” “S_1” “G” “real” “““P1(port1)M1”

This example adds an unscaled real plot of the data from the solution S_1for Port1, mode1 to the plot named Plot 1. The type of data plotted mustbe the same as the type of data plotted in the plot to which you are add-ing. In this example, the first plot was of the S-matrix data. Since thegraph is unscaled and the input signal is not being plotted, the Signalname is left blank.

SzgPlotCancelCalcEdit

Use: Cancels any changes you have made to the expressions before saving.Command: Edit/Calculated Expressions

Syntax: szgplotcancelcalcedit

SzgPlotCancelSigEdit

Use: Cancels any changes you have made to the signals you have definedbefore saving.

Command: Edit/Input Signal

Syntax: szgplotcancelsigedit

SzgPlotCreate

Use: Creates a new plot and assigns the plot a name. This name is returned tothe macro or command prompt and can be assigned to a variable. Aftercreating the plot, use the SzgPlotAddGraphs command to add a graph tothe plot.

Command: Plot/New Plot

Syntax: szgplotcreate “plot type” “domain” “scaling type”

Note: plot type: smith=Smith Chart, cartesian=Cartesian plotdomain: time=Plot vs. time, freq=Plot vs. frequencyscaling type: Use one of the following:.

Example: szgplotcreate “cartesian” “freq” “unscaled”

This example creates an unscaled cartesian plot versus frequency.

S, Y, Z dataG, Zpi, Zpv, Zvi

data Emissions data

P#(port#)M#:P#M# P#(port#)M# Emission test name

dBvswrunscaled

Page 225: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Command Sets

Post Processor Script Commands 10-75

SzgPlotImport

Use: Loads a previously saved graph.Command: Plot/Open

Syntax: szgplotimport “file” plot_name

Note: plot_name: The name of the plot. To add the imported information tothe plot, provide a plot name. To create a new plot, leave this unspecified(do not provide a plot name).

Example: szgplotimport “d:/ansoft/projs/test.pjt/test.dat” -1

This example creates a new plot and graphs the data saved in test.dat.SzgPlotKernelAddExpr

Use: Adds an expression to the Defined Signals list. Use SzgPlotAcceptCalcEditto save the signal after defining it. Each pair of values defines a singlecomplex value.

Command: Edit/Calculated Expressions

Syntax: szgplotkerneladdexpr “solution name” data_type“expression name” {real_value imaginary_value}

Note: data_type: 0=S-matrix, 1=Y-matrix, 2=Z-matrixreal and imaginary: For each frequency point, enter a real andimaginary value.

Example: szgplotkerneladdexpr “S_3” 0 “Expr1” { 0.080307050.139994 0.1306709 0.1466202 }

This example adds an expression called Expr1 to the Defined Signals list.The expression is taken from the S-matrix for the frequency solution S_3.It has two frequency points, each of which is given a real and imaginaryvalue. The first value is (0.08030705, 0139994).

SzgPlotKernelDelExpr

Use: Deletes an expression from the Defined Signals list. Use theSzgPlotAcceptCalcEdit command to save your changes.

Command: Edit/Calculated Expressions

Syntax: szgplotkerneldelexpr “solution name” data_type“expression name”

Note: data_type: 0=S-matrix, 1=Y-matrix, 2=Z-matrixExample: szgplotkerneldelexpr “S_3” 0 “Expr1”

This example removes the expression called Expr1 from the Defined Sig-nals list. The expression, derived from the S-matrix, is removed from thefrequency solution S_3.

Page 226: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Command Sets

10-76 Post Processor Script Commands

SzgPlotKernelEditFft

Use: Modifies the maximum viewing frequency and the number of points thatare plotted for the specified signal.

Command: Edit/Input Signal

Syntax: szgplotkerneleditfft “signal name” points frequency

Note: points: Number of points must equal , where n = 4, 5, 6, ... 14.Example: szgplotkerneleditfft “Pulse1” 512 2000000000

This example sets the maximum viewing frequency to 2 GHz and thenumber of points that are plotted to 512. Enter the frequency in Hz.

SzgPlotKernelEditSigPulse

Use: Defines a signal using its amplitude, period, duty cycle, and rise time.Command: Edit/Input Signal

Syntax: szgplotkerneleditsigpulse “signal name” pointsmax_frequency amplitude period rise_time duty_cyclepositive_only?

Note: points: Number of points must equal , where n = 4, 5, 6, ... 14.positive_only: 0=No, 1=Yes (Positive only)

Example: szgplotkerneleditsigpulse “Pulse1” 512 1000000000 11E-08 1E-09 40 0

This example defines the signal Pulse1 with an amplitude of 1, a period of10 nanoseconds, a rise time of 1 nanosecond, and a duty cycle of 40 per-cent. The maximum viewing frequency is 1 GHz, the number of pointsplotted is 512, and both the positive and negative portions of the wave-form are displayed.

SzgPlotKernelEditSigXY

Use: Defines a time domain signal by specifying points on the signal.Command: Edit/Input Signal

Syntax: szgplotkerneleditsigxy “signal name” pointsmax_frequency number_of_time_points { time1 value1time2 value2 ...}

Note: points: Number of points must equal , where n = 1, 2, 3, ... 14.Example: szgplotkerneleditsigxy “Time” 512 1000000000 8 { 0 1

0.1 2 0.3 2 0.4 1 0.6 1 0.7 2 0.9 2 1 1 }

This example creates the time domain signal Time with 8 points startingat (0,1) and ending at (1,1). The maximum viewing frequency is 1 GHzand the number of points plotted is 512. Enter time in seconds.

2n

2n

2n 3+

Page 227: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Command Sets

Post Processor Script Commands 10-77

SzgPlotKernelExit

Use: Exits the Matrix Plot Post Processor. You may elect to save your session.Command: File/Exit

Syntax: szgplotkernelexit “save/nosave”

Example: szgplotkernelexit “nosave”

This example exits the Matrix Plot Post Processor without saving.SzgPlotKernelFitAll

Use: Fits the entire plot in the window.Command: View/Fit All

Syntax: szgplotkernelfitall “plot name”

SzgPlotKernelMaximize

Use: Maximizes the viewing window.Command: View/Maximize

Syntax: szgplotkernelmaximize “plot name”

SzgPlotKernelSave

Use: Saves the plot to the file you specify.Command: Plot/Save

Syntax: szgplotkernelsave “plot name” “save file and location”

Example: szgplotkernelsave “Plot 2: S Matrix Data” “/hfss/cpw.pjt/plot.dat”

This example saves the plot Plot 2: S Matrix Data to the file plot.dat in thedirectory /hfss/cpw.pjt/.

SzgPlotKernelSaveCalc

Use: Saves any expressions created with SzgPlotKernelAddExpr to a disk file.Command: File/Save Calculated Expressions

Syntax: szgplotkernelsavecalc

SzgPlotKernelSaveSig

Use: Saves all input signals created with SzgPlotKernelEditFft,SzgPlotKernelEditSigPulse, or SzgPlotKernelEditSigXY to a disk file.

Command: File/Save Input Signals

Syntax: szgplotkernelsavesig

SzgPlotKernelSetSigName

Use: Renames an input signal.Command: none

Syntax: szgplotkernelsetsigname “old name” “new name”

Page 228: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Command Sets

10-78 Post Processor Script Commands

SzgPlotKernelZoom

Use: Zooms toward or away from a plot. This is strictly an interactivecommand; do not use this for macros that you want to run withoutstopping for input.

Command: View/Zoom In, View/Zoom Out

Syntax: szgplotkernelzoom “plot name” “direction”

Note: direction: in=Zoom in, out=Zoom outExample: szgplotkernelzoom “Plot 1: S Matrix Data” “in”

This example zooms in on the plot Plot 1: S Matrix Data.SzgPlotSetupCalcEdit

Use: Instructs the system to prepare for commands that define or changecalculated expressions, such as SzgPlotKernelAddExpr orSzgPlotKernelDelExpr.

Command: Edit/Calculated Expressions

Syntax: szgplotsetupcalcedit

SzgPlotSetupSigEdit

Use: Instructs the system to prepare for commands that define or change inputsignals, such as SzgPlotKernelEditFft, SzgPlotKernelEditSigPulse, orSzgPlotKernelEditSigXY.

Command: Edit/Input Signal

Syntax: szgplotsetupsigedit

Page 229: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Script Commands 11-1

11

Wizard Script Commands

This chapter describes the script commands that allow you to create wizards.A wizard is a graphical interface that prompts the user for the necessaryinformation to complete a task.

Page 230: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Arguments

11-2 Wizard Script Commands

Wizard ArgumentsSeveral wizard script commands require complicated arguments that areexplained in detail in this section, rather than with the commands themselves.

Information TypesWhen creating a wizard field using the AddWizardField command, you mustspecify the type of information the wizard expects the user to enter. There arenine types of information:

LONG An integer.

DOUBLE A double precision floating point number.

DOUBLE LIST A list of double precision floating point numbers. The usermust enter the data in the following form: {# # #}.

STRING A character sequence. The user does not need to enclosethe character sequence in quotes unless it contains embed-ded blanks or punctuation.

STRING LIST A list of strings. The user must enter the data in the follow-ing form: {“string1” “string2” “string3”}.

VEC2 A 2D vector, with an x- and y-component. The user mustenter the data in the following form: <x, y>.

VEC3 A 3D vector, with an x-, y-, and z-component. The usermust enter the data in the following form: <x, y, z>.

POS2 A 2D position, with an x- and y-component. The user mustenter the data in the following form: [x, y].

POS3 A 3D position, with an x-, y-, and z-component. The usermust enter the data in the following form: [x, y, z].

Page 231: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Arguments

Wizard Script Commands 11-3

Mathematical FunctionsWhen creating a validating expression to test the contents entered in the wiz-ards fields with the AddWizardValidatorExpr command, you must use theappropriate syntax for the mathematical functions. The following legal func-tions may be used to define mathematical expressions:

/ Divide+ Add- Subtract and unary minus* Multiply% Modulo** Exponentiate<< Left shift>> Right shift= Assigns== Equal to!= Not equal to> Greater than< Less than>= Greater than or equal to<= Less than or equal to& Bitwise AND| Bitwise OR^ Bitwise XOR~ 1’s compliment&& Logical AND|| Logical OR! Factorialif IF statementsign Returns the sign of an argument. Syntax: sign (x)abs Absolute value. Syntax: abs (x)exp Exponential. Syntax: exp (x) = ex

pow Raises the specified value to the specified power.Syntax: pow (x, y) = xy

ln Natural log. Syntax: ln (x)log Log base 10. Syntax: log (x)lg Log base 2. Syntax: lg (x)sqrt Square root. Syntax: sqrt (x)floor Rounds down to an integer. Syntax: floor (x)

Page 232: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Arguments

11-4 Wizard Script Commands

All trigonometric expressions expect their arguments to be in degrees, andthe inverse trigonometric functions’ return values are in degrees. These func-tion names are reserved and may not be used as variable names.

ceil Rounds up to an integer. Syntax: ceil (x)round Rounds to nearest integer. Syntax: round (x)rand Generates a random number between 0 and 1. Syntax: rand ()deg Convert radians to degrees. Syntax: deg (x)rad Convert degrees to radians. Syntax: rad (x)sin Sine. Syntax: sin (x)cos Cosine. Syntax: cos (x)tan Tangent. Syntax: tan (x)asin Arc sine. Syntax: asin (x)acos Arc cosine. Syntax: acos (x)atan Arc tangent. Syntax: atan (x)atan2 Arc tangent (in the range of -n/2 to n/2). Syntax: atan2 (x)sinh Hyperbolic sine. Syntax: sinh (x)cosh Hyperbolic cosine. Syntax: cosh (x)tanh Hyperbolic tangent. Syntax: tanh (x)

Page 233: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-5

Wizard ExampleThe following example of a wizard macro demonstrates the use of the mostcommon wizard script commands. This wizard creates and solves the gettingstarted problem.The wizard is separated into several macros: the main macro that executesmost of the wizards, and the secondary macros executed when a button ispushed. The secondary macros are explained later in this section.These macros can be found in the examples/macros/wizard_examples directoryon the CD.

The Main MacroThe following macro demonstrates the use of the wizard script commandsand how several wizards can be executed from a single macro.Any lines beginning with a # are comments, and are ignored by the software.You do not necessarily need to type them here, although commenting is avery important part of writing macros, and you should make sure you canreturn to your macro a few years from writing it and understand what it does.

# Create the wizard and add the interface elements you want it to display. This# first wizard is an introductory message, letting the user know what to# expect from this macro.

CreateWizard “begin”

# Add text to the wizard interface. Notice the use of “\n” as a line break.

AddWizardText “begin” “This is a demonstration of\the wizard script commands available in Ansoft HFSS. \\n It will take you through the Ansoft HFSS Getting \Started guide problem \n and demonstrate the features\available in the wizard script commands. \n Because \this is an example, the methods used will not be the \most efficient \n for completing the problem.”

AddWizardText “begin” “Choose OK to get started!”# Define the text that appears in the title bar of the wizard's window.

SetWizardTitle “begin” “Wizard Demonstration”

# Execute the wizard. The interface appears with the elements defined for# the specified wizard. Once the user chooses OK, the wizard macro continues.

Page 234: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-6 Wizard Script Commands

# As the software starts to execute the wizard, the wizard is loaded into the# computer memory. After the user selects OK, the wizard is executed, and# any variables created by the wizard are also loaded into memory.## Use the StopWizard command to remove the variables the wizard creates, and# DestroyWizard to delete the wizard definition. If you perform a# StopWizard without a DestroyWizard, you may run the wizard again without# executing the macro, since the wizard is still in memory.## If you want to keep the variables created by the wizard to use later in the macro,# do not use StopWizard unless you first assign their values to other macrovariables.

RunWizard “begin”StopWizard “begin”DestroyWizard “begin”

LaunchModeler “modify”

# Create the following wizard to allow the user to select the units for the# problem. You may create as many wizards in a single macro as you wish;# however, the variables for each wizard must be unique unless you destroy# one before you run another.

CreateWizard “mod1”

AddWizardText “mod1” “Select units for the problem:”

# The next section creates a vertical list of radio buttons, with each button assigned# a unique variable and corresponding text label. When the user selects one of the# buttons, the variable corresponding to that button is assigned a value of 1. The# unselected buttons are assigned a value of 0. This behavior allows you to test the# value of each variable and perform an action depending on whether that button# is selected or not.

AddWizardButtons “mod1” “radio” 20 {“km1” “meters1”\“cm1” “mm1” “microns1” “nm1” “yards1” “feet1”\“inches1” “mils1”} {“km” “meters” “cm” “mm”\“microns” “nm” “yards” “feet” “inches” “mils”} {“”}\“vertical”

# Add a help button with the specified message. The variable status indicates# whether the user has clicked on OK (status=1) or Cancel (status=0).

AddWizardHelp “mod1” “Select ‘cm’ for the units.”Assign status RunWizard “mod1”

Page 235: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-7

# The following series of IF statements tests each button variable to determine if it# was selected. If the button was selected (has a value of 1), the contents of# the IF statement are executed.

If EQ status 1If EQ km1 1

SetUnits “km” “y”EndIf EQ meters1 1

SetUnits “meters” “y”EndIf EQ cm1 1

SetUnits “cm” “y”EndIf EQ mm1 1

SetUnits “mm” “y”EndIf EQ microns1 1

SetUnits “microns” “y”EndIf EQ nm1 1

SetUnits “nm” “y”EndIf EQ yards1 1

SetUnits “yards” “y”EndIf EQ feet1 1

SetUnits “feet” “y”EndIf EQ inches1 1

SetUnits “inches” “y”EndIf EQ mils1 1

SetUnits “mils” “y”End

# Because the macro used the variables created by the wizard for the previous IF# statements, a StopWizard and DestroyWizard were not performed until now.# Note that the StopWizard command is not needed if the user pressed Cancel.

StopWizard “mod1”EndDestroyWizard “mod1”

# Create the wizard that draws the model.

CreateWizard “mod2”

Page 236: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-8 Wizard Script Commands

# The following statements create a series of push buttons, with each button# performing a specific set of actions when pressed. Several of the buttons execute# a separate macro, which may even contain a secondary wizard that acts like a# subwindow. The series of actions corresponds to the series of buttons. In# situations where you do not need to define an action for a button, leave the# action string empty (“”). Otherwise, the referenced actions will be associated# with the wrong buttons.## Note that these buttons are placed closely together in a vertical arrangement. If# you want to create a space between the buttons, use separate AddWizardButtons# commands and the AddWizardText command to create space between the# buttons.## The secondary macros that these buttons execute are explained later in this# section.

AddWizardButtons “mod2” “push” 40 {“dhorn” “dsweep”\“dbox” “candp” “subt”} {“Draw the 2D Horn” “Sweep\the Cross Section” “Draw the abc” “Cut and Paste the\Horn” “Subtract the Horn from the abc”} {“fileexec\'pline1.mac'” “FileExec 'sweep1.mac'” “FileExec\'box1.mac'” “FileExec 'candp1.mac'” “Subtract aname\GetObjectName nprev1”} “vertical”

RunWizard “mod2”

Save3d “*” “??”

# The following command exits the 3D Modeler. Some of the variable values# assigned within this wizard will be needed later, so neither StopWizard nor# DestroyWizard is used at this point.

ExitLaunchMaterials “modify”

# Create the wizard that assigns materials to the objects.

CreateWizard “mat1”

SetWizardTitle “mat1” “Assign Materials”

AddWizardText “mat1” “Select the objects to be\assigned as vacuum:”

Page 237: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-9

# The next section creates two checkboxes that the user can select. Like a radio# button, when a checkbox is selected, a value of 1 is assigned to the# corresponding variable, otherwise it is 0. Again, the variable status is used to# check whether the user chose OK or Cancel from the wizard window.

AddWizardButtons “mat1” “check” 20 {“vac1” “vac2”}\{“Horn” “abc”} {} “vertical”

Assign status RunWizard “mat1”

# Notice that the variables that contain the names of the objects, which were# assigned in wizard pline1.mac, are used here.

If EQ status 1If EQ vac1 1

MaterialAssign pname “OCS” {“ 0.0000000000" \“ 0.0000000000" “ 0.0000000000"}\{“ 0.0000000000" “ 0.0000000000" \“ 0.0000000000"}

End

If EQ vac1 1MaterialAssign aname “OCS” {“ 0.0000000000" \“ 0.0000000000" “ 0.0000000000"} \{" 0.0000000000" “ 0.0000000000" \“ 0.0000000000"}

EndStopWizard “mat1”

EndDestroyWizard “mat1”

SaveModuleExitModule 1LaunchBoundaries “modify”

# Create a wizard that assigns boundaries to the objects. This wizard is similar to# the one that assigned materials.

CreateWizard “bound1”SetWizardTitle “bound1” “Define Boundaries”AddWizardText “bound1” “Select the boundaries to\define:”AddWizardButtons “bound1” “check” 20 {“b1” “b2” “b3”\“b4” “b5”} {“Port” “Perfect E” “Perfect H” “Symmetry\Plane” “Radiation Boundary”} {} “vertical”

Assign status RunWizard “bound1”

Page 238: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-10 Wizard Script Commands

If EQ status 1If EQ b1 1

SetViewDirection <-35.3653280568897,\-70.7306561137793, -106.095984170669>

PickFaceByRay [38.318427880327,\77.0848685359688, 115.529438080892]

SelectNextEntSetImpedanceMultiplier “0.5”CreateBoundaryClearSelection

End

If EQ b2 1TogglePickObjObjInt pname anameSetBoundary “perfect_e”SetBndName “intersection”CreateBoundaryClearSelection

End

If EQ b3 1SetViewDirection <-35.3653280568897, \-70.7306561137793,-106.095984170669>

PickFaceByRay [40.0435078746225,\70.9135096873329, 119.068650780103]

SetViewDirection <-35.3653280568897, \-70.7306561137793, -106.095984170669>

PickFaceByRay [36.2373904631469, \74.0608228113882, 118.239147803726]

SelectNextEntSetBoundary “perfect_h”SetBndName “aperture”CreateBoundaryClearSelection

End

Page 239: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-11

If EQ b4 1SetViewDirection <-35.3653280568897, \-70.7306561137793,-106.095984170669>

PickFaceByRay [38.061374237766, \76.674218442645, 115.888889370656]

SetViewDirection <-35.3653280568897, \-70.7306561137793, -106.095984170669>

PickFaceByRay [38.3922527104041, \76.3014034699397, 116.027139866718]

SetViewDirection <-35.3653280568897, \-70.7306561137793,-106.095984170669>

PickFaceByRay [36.8890992383657, \71.3294098816983, 119.842853558056]

SetBoundary “symmetry”SetBoolean 0SetBndName “symmetry”CreateBoundaryClearSelection

End

If EQ b5 1SetViewDirection <-35.3653280568897, \-70.7306561137793, -106.095984170669>

PickFaceByRay [34.3015207218193, \75.9826860694288, 117.603195521836]

SelectNextEntSetViewDirection <-35.3653280568897, \-70.7306561137793,-106.095984170669>

PickFaceByRay [34.8764520091051, \70.7182027525158, 120.921207427347]

SelectNextEntSetViewDirection <-35.3653280568897, \-70.7306561137793, -106.095984170669>

PickFaceByRay [33.2145950514814, \73.4984631533585, 119.621652764355]

SelectNextEntSetViewDirection <-35.3653280568897, \

Page 240: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-12 Wizard Script Commands

-70.7306561137793,-106.095984170669>

PickFaceByRay [34.3015207218193, \75.9826860694288, 117.603195521836]

SetViewDirection <-35.3653280568897, \-70.7306561137793,-106.095984170669>

PickFaceByRay [34.1755266805016, \73.9719257262251, 118.985700482465]

SetBoundary “radiation”SetBndName “radiation”CreateBoundaryClearSelection

EndStopWizard “bound1”

EndDestroyWizard “bound1”SetImpedanceMultiplier “0.5”SaveBndsExitBnds 1

# Create a wizard that prompts the user for the setup solution information. Several# options normally available from the Setup Solution window are omitted here# because they are not required for the problem, such as the frequency sweep# information.

CreateWizard “setup1”SetWizardTitle “setup1” “Define the Solution Parameters”

# For the checkbox below, notice that the action associated with it enables the edit# field associated with the variable sing_freq. The edit field is only enabled when# this checkbox is selected. You can disable a button or field with the RunWizard# command.

AddWizardButtons “setup1” “check” 50 {“s1”} {“Single\Frequency”} {“SetWizardControlState 'setup1' \'sing_freq' 1 1 1”} “horizontal”

# Notice that the user must enter the frequency in Hz. This is because the software# uses Hz when dealing with frequency, and converts it for display purposes.# Because the script commands deal directly with the kernel of the software, all# frequencies must be entered in Hz. You can allow the user to specify the# units of frequency for display purposes, but all frequencies must be entered in# Hz.

AddWizardField “setup1” “sing_freq” “dbl” “Enter the\Frequency in Hz:”

Page 241: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-13

AddWizardButtons “setup1” “push” 20 {“fr1”} {“Freq.\Units...”} {“FileExec 'freq1.mac'”} “horizontal”

AddWizardButtons “setup1” “check” 50 {“s2”} \{“Adaptive”} {“FileExec 'enable.mac'”} “horizontal”

AddWizardField “setup1” “num_passes” “dbl” \“Requested Passes:”

AddWizardField “setup1” “tet_refine” “dbl” \“Tet. Refinement:”

AddWizardField “setup1” “max_ds” “dbl” “Max Delta S”

SetWizardFieldDefault “setup1” “num_passes” “3”SetWizardFieldDefault “setup1” “tet_refine” “20”SetWizardFieldDefault “setup1” “max_ds” “0.02”

AddWizardText “setup1” “Select the Mesh:”

AddWizardButtons “setup1” “radio” 30 {“m1” “m2” “m3” \“m4”} {“Initial Mesh” “Current Mesh” “Previous Mesh” \“Manual Mesh”} {} “horizontal”

AddWizardText “setup1” “Select What to Solve:”

AddWizardButtons “setup1” “radio” 30 {“so1” “so2” \“so3” “so4”} {“Solve All” “Solve Ports Only” \“Solve Impedance Only” “Solve Emissions Only”} \{} “horizontal”

AddWizardText “setup1” “Select which modes for which\to save fields:”

Page 242: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-14 Wizard Script Commands

# The following statements create a radio button series with three options. Notice# the commands associated with the three buttons. The first two disable the edit# field associated with the variable n_modes. The third button’s action activates the# edit field.## Initially, the edit field is disabled. The first two buttons disable the field if# the user selects the third button by mistake and activates the field.

AddWizardButtons “setup1” “radio” 30 {“mo1” “mo2” \“mo3”} {“All Modes” “Dominant Mode” “First N Modes”}\{“SetWizardControlState 'setup1' 'n_modes' 0 1 1"\“SetWizardControlState 'setup1' 'n_modes' 0 1 1"\“SetWizardControlState 'setup1' 'n_modes' 1 1 1"}\“horizontal”AddWizardField “setup1” “n_modes” “dbl” “Max Modes:”

# Since some of the previous edit fields required a checkbox to be selected before# they were enabled, you must disable them when the wizard is first run. When# the appropriate checkbox is selected, the fields become active.

Assign status RunWizard “setup1” {“sing_freq:disable” \“num_passes:disable” “tet_refine:disable” \“max_ds:disable” “n_modes:disable”}

If EQ status 1If EQ m1 1

SetMeshType “initial”EndIf EQ m2 1

SetMeshType “current”End

Page 243: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-15

# In the following IF statements, AND is used to check which two radio buttons# are selected. Only a few of the possible permutations are demonstrated here.

If EQ AND so1 mo1 1SetSolverComputation “all_fields” “all_modes” 1

EndIf EQ AND so1 mo2 1

SetSolverComputation “all_fields” “dominant_mode” 1EndIf EQ AND so1 mo3 1

SetSolverComputation “all_fields” “N_modes” n_modesEnd

SetFrequency sing_freqSetAdaptiveInfo num_passes “conv_delta” tet_refineSetConvDelta max_dsSetSolutionType s1 s2 0 1 2SolveSetupSaveEditableSolveParmsExitSolveSetupStopWizard “setup1”

EndDestroyWizard “setup1”SolveNominal

Enable.macThis macro enables the edit fields for num_passes, tet_refine, and max_dswhen the Adaptive checkbox is selected.

SetWizardControlState “setup1” “num_passes” 1 1 1SetWizardControlState “setup1” “tet_refine” 1 1 1SetWizardControlState “setup1” “max_ds” 1 1 1

Page 244: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-16 Wizard Script Commands

Pline1.macThis macro draws the polyline objects used in creating the horn object in theHFSS guide Getting Started: An Antenna Problem.

# Create the wizard that draws the 2D polyline object.

CreateWizard “mod3”SetWizardTitle “mod3” “Draw the 2D Cross Section”

# Add the fields for the name and vertices of the object. Notice that the vertex fields# are pos3 variable types. The software expects the user to enter a 3D position# using the syntax [#, #, #]. If they do not use the correct syntax, an error message# appears. The variable types are explained at the beginning of this chapter.

AddWizardField “mod3” “pname” “string” “Enter the \name of the object:”AddWizardField “mod3” “vert1” “pos3” “Enter the \coordinates for the first vertex:”AddWizardField “mod3” “vert2” “pos3” “Enter the \coordinates for the second vertex:”AddWizardField “mod3” “vert3” “pos3” “Enter the \coordinates for the third vertex:”AddWizardField “mod3” “vert4” “pos3” “Enter the \coordinates for the fourth vertex:”AddWizardField “mod3” “vert5” “pos3” “Enter the \coordinates for the fifth vertex:”AddWizardField “mod3” “vert6” “pos3” “Enter the \coordinates for the sixth vertex:”

# The following statements set the defaults for the edit fields defined above.# Because the data entered in the edit fields must conform to a specific syntax for# many variable types, it is a good idea to demonstrate the proper syntax for the# data.

SetWizardFieldDefault “mod3” “pname” “Enter the \name of the horn”SetWizardFieldDefault “mod3” “vert1” “[0, 0, 0]”SetWizardFieldDefault “mod3” “vert2” “[0, 0, 0]”SetWizardFieldDefault “mod3” “vert3” “[0, 0, 0]”SetWizardFieldDefault “mod3” “vert4” “[0, 0, 0]”SetWizardFieldDefault “mod3” “vert5” “[0, 0, 0]”SetWizardFieldDefault “mod3” “vert6” “[0, 0, 0]”

AddWizardHelp “mod3” “Enter the following for the \name and coordinates: nhorn\n[0, 0, 0]\n[0, \1.065, 0]\n[0, 1.065, 3]\n[0, 1.965, 4.56]\n[0, \1.965, 8.67]\n[0, 0, 8.67]”

Page 245: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-17

Assign status RunWizard “mod3”If EQ status 1

EditPline pnameAddVert vert1AddVert vert2AddVert vert3AddVert vert4AddVert vert5AddVert vert6ClosePlineEndPlineFitAllViews

# The following two script commands allow you to change the wizard’s buttons# while the wizard is still running. Because these commands operate on the wizard# definition itself, they may only be used if they are part of the action command of# a button. These operate on the wizard mod2, which is still running.

SetWizardControlText “mod2” “dhorn” “Done!”SetWizardControlState “mod2” “dhorn” 0 0 1StopWizard “mod3”

EndDestroyWizard “mod3”

Sweep1.macThis macro sweeps the 2D polyline object to form the 3D horn.

# This macro, unlike most of the other secondary macros, does not create a wizard.# Instead, it executes several script commands. Button command actions only# allow a single command to be executed. If you want to execute several# commands, you need to create a separate macro like this one.

SweepAxis pname 2 180 12 0 0SetWizardControlText “mod2” “dsweep” “Done!”SetWizardControlState “mod2” “dsweep” 0 0 1

Candp1.macThis macro copies the horn and pastes the copy back into the model. This isbecause when you subtract an object, the subtracted object is deleted.

Select pnameSelCopySelPasteSetWizardControlText “mod2” “candp” “Done!”SetWizardControlState “mod2” “candp” 0 0 1Assign nprev1 GetNumObjectsFitAllViews

Page 246: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-18 Wizard Script Commands

Box1.macThis macro draws the box representing the extent of the absorbing boundary.

# Create a wizard to draw a box. A box requires that you specify the starting point# of the box and the size of the box.

CreateWizard “mod4”

AddWizardField “mod4” “aname” “string” “Enter the \name of the box:”

AddWizardField “mod4” “point1” “dbl” “Enter the \x-coordinate for the starting point:”AddWizardField “mod4” “point2” “dbl” “Enter the \y-coordinate for the starting point:”AddWizardField “mod4” “point3” “dbl” “Enter the \z-coordinate for the starting point:”

AddWizardField “mod4” “x_size” “dbl” “Enter the \size in the x-direction:”AddWizardField “mod4” “y_size” “dbl” “Enter the \size in the y-direction:”AddWizardField “mod4” “z_size” “dbl” “Enter the \size in the z-direction:”

SetWizardFieldDefault “mod4” “aname” “abc”SetWizardFieldDefault “mod4” “point1” “0”SetWizardFieldDefault “mod4” “point2” “-3.5”SetWizardFieldDefault “mod4” “point3” “7.67”SetWizardFieldDefault “mod4” “x_size” “-3.5”SetWizardFieldDefault “mod4” “y_size” “7”SetWizardFieldDefault “mod4” “z_size” “3”

AddWizardHelp “mod4” “Enter the following for the \name, coordinates, and size:\nabc\nx-coord: \0\ny-coord: -3.5\nz-coord: 7.67\nx=-3.5\ny=7\nz=3”

SetWizardTitle “mod4” “Draw the Box”

# The following statements demonstrate how to use mathematical expressions# to validate the data entered in the edit fields. Use the syntax and mathematical# commands explained at the beginning of this chapter to construct the# expressions.

Page 247: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-19

AddWizardValidatorExpr “mod4” “validator1” \“x_size + y_size + z_size == 6.5"

AddWizardValidatorExpr “mod4” “validator2” \“point1 + point2 + point3 == 4.17"

Assign status RunWizard “mod4”If EQ status 1

Box POS3 point1 point2 point3 x_size y_size \z_size aname

FitAllViewsSetWizardControlText “mod2” “dbox” “Done!”SetWizardControlState “mod2” “dbox” 0 0 1StopWizard “mod4”

EndDestroyWizard “mod4”

Freq1.macThis macro allows the user to select the units for the frequency.

CreateWizard “freq1”AddWizardText “freq1” “ Select frequency units:”

AddWizardButtons “freq1” “radio” 20 {“ghz1” “hz1” \“mhz1” “khz1”} {“GHz” “Hz” “MHz” “kHz”} {} “vertical”

Assign status RunWizard “freq1”

If EQ ghz1 1SetFrequencyUnit “GHz”

EndIf EQ hz1 1

SetFrequencyUnit “Hz”EndIf EQ mhz1 1

SetFrequencyUnit “MHz”EndIf EQ khz1 1

SetFrequencyUnit “kHz”End

StopWizard “freq1”EndDestroyWizard “freq1”

Page 248: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-20 Wizard Script Commands

User Menu AdditionsThe following commands are classified as Default commands in the interface,but are part of the commands referred to as User Menu Additions, and are nottruly part of any module.

AddHelpSelboxItem

Use: Adds an item to the active module help selection box.Command: none

Syntax: addhelpselboxitem {item hierarchy} “description”“macro filename”

Note: The acceptable values are as follows:Item hierarchy is a string list.Description is a string that describes the help item.Macro filename is a string containing the name of the macro file.

Example: addhelpselboxitem {“sketch” “fill”} “fills the currentsketch with color” “sketch3d.mac”

This example adds the description to the Sketch/Fill command whichuses the sketch3d.mac macro file to complete the step when invoked.

AddMenuItem

Use: Adds a menu item to the end of the menu bar or to the end of an existingmenu. The macro file is executed when the menu item is selected.

Command: none

Syntax: addmenuitem {item hierarchy} “description” “macrofilename”

Note: The acceptable values are as follows:Item hierarchy is a string list.Description is a string that describes the help item.Macro filename is a string containing the name of the macro file.

Example: addmenuitem {“sketch” “fill”} “fills the currentsketch with color” “sketch3d.mac”

This adds the Sketch/Fill command to the menu and invokes thesketch3d.mac to execute the command.

AddMenuSeparator

Use: Adds a user menu separator.Command: none

Syntax: addmenuseparator <menu hierarchy>

Note: Menu hierarchy is a string list.Example: addmenuseparator <“sketch” “fill”>

This adds a separator after Sketch/Fill in the user-defined menu.

Page 249: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-21

DebugFileExec

Use: Accesses the Macro Debugger to allow you to monitor the execution andmodify values in a running macro. Refer to the online documentation formore information on the Macro Debugger.

Command: none

Syntax: debugfileexec “macro file”

Note: Macro file can include the path and filename of the macro.Example: debugfileexec “c:\maxwell\antenna.pjt\modelant.mac”

This example loads the modelant.mac file in the Macro Debugger andraises the debugger window.

DeleteHelpSelboxItem

Use: Deletes a help selection box item.Command: none

Syntax: deletehelpselboxitem {item hierarchy}

Note: Item hierarchy is a string list.Example: deletehelpselboxitem {“sketch” “fill”}

This example deletes the item for the Sketch/Fill hierarchy.DeleteMenuItem

Use: Deletes a menu item from the hierarchy. You may delete an intermediatelayer of the hierarchy, provided it is a user-defined addition.

Command: none

Syntax: deletemenuitem {item hierarchy}

Note: Item hierarchy is a string list.Example: deletemenuitem {“sketch” “fill”}

This example removes the user-defined item Sketch/Fill from the menu.DisableMenuItem

Use: Disables a user-defined menu item.Command: none

Syntax: disablemenuitem {item hierarchy}

Note: Item hierarchy is a string list.Example: disablemenuitem {“sketch”}

This example disables the user-defined Sketch menu item.

Page 250: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-22 Wizard Script Commands

MacroDebugger

Use: Accesses the Ansoft Macro Debugger.Command: none

Syntax: macrodebugger “macro filename”

Note: The macro filename must include the path to the macro.SetMenuItemHotkey

Use: Defines the hotkey for a user-defined menu item.Command: none

Syntax: setmenuitemhotkey {hierarchy} “hotkey”

Note: hierarchy: This is a string list identifying the menu item to which toassign the hotkey.

Example: setmenuitemhotkey {“sketch” “fill”} “ctrl-f4”

This example sets Control-F4 as the hotkey for the user-defined menuitem “Sketch/Fill.”

Page 251: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-23

Wizard Script CommandsThe following script commands are classified as Wizard script commands.

AddWizardButtons

Use: Adds push, checkbox, or radio buttons to the wizard. Radio buttons andcheckboxes are assigned variables that allow the software to trackwhether the button was selected or not. In addition, several wizard scriptcommands use the variables assigned to buttons to manipulate them.

Command: none

Syntax: addwizardbuttons “wizard name” “button type”button_width {“variable names”} {“button labels”}{“command actions”} “orientation” {pixmap files}

Note: button type: Enter one of the following:

button_width: Number of characters wide that the buttons will be.variable names: The variables used to identify the buttons.button labels: The text labels of the buttons.command actions: Script command to execute when the button ispressed. Use the FileExec script command to execute multiple commandsfor each button.orientation: vert=vertical, horiz=horizontalpixmap files is a string list where optional contents are used only forPUSH buttons and specifies the files containing the pixmap definitions.

Example: addwizardbuttons “input_geo” “push” 20 {“var1” “var2”“var3”} {“box 1" “box 2" “box 3"} {“fileexec'geo.mac’” “box [0, 100, 100] 100 100 100 'box2'” “box[0, 100, 100] -100 -100 -100 'box3'”} “vertical”

Creates three buttons labeled Box 1, Box 2, Box 3 in a vertical formation.The buttons are identified by the variables var1, var2, var3. The first but-ton executes the script command geo.mac, which could contain a secondwizard that acts as a subwindow. The second and third buttons drawboxes named box2 and box3, respectively.

☞Note: For checkboxes and radio buttons, the variables associated with these but-

tons have two possible values: 1 indicates that the button is selected, 0 indi-cates that the button is unselected.

Type Description

push A push button.

check A checkbox. Allows you to turn an option on or off.

radio A radio button. Allows you to select from several options.

Page 252: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-24 Wizard Script Commands

AddWizardField

Use: Creates the fields in which values are entered from the wizard window.Each field is given a variable name which is assigned the value the userenters. When you create a field, you must specify the variable type of thevalue entered. The variable types are listed in detail at the beginning ofthis chapter.

Command: none

Syntax: addwizardfield “wizard name” “variable name” “variabletype” “prompt”

Note: variable name: The variable to which the value entered is assigned.variable type: Enter one of the following:

LONGDOUBLE or DBLDOUBLE_LIST or DLISTSTRING or STRSTRING_LIST, STRLIST, or LISTPOS2POS3VEC2VEC3

prompt: The name or prompt for the field.Example: addwizardfield “input_geo” “width” “dbl” “enter the width:”

Creates a field labeled “Enter the width:” for the wizard input_geo. Thevalue entered in this field is a double precision floating point number andis assigned to the variable width.

AddWizardHelp

Use: Adds a help button to the wizard with the specified help text. Whenspecifying the help text, use \n to indicate a carriage return.

Command: none

Syntax: addwizardhelp “wizard name” “help text”

Example: addwizardhelp “wizard1” “you must enter a value \n\greater than zero.”

Creates a help button in the wizard wizard1 with the text, “You mustenter a value greater than zero.” The text takes up two lines, with the sec-ond line starting with “greater.”

Page 253: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-25

AddWizardSelbox

Use: Adds a selection box to a wizard panel.Command: none

Syntax: addwizardselbox “wizard name” “field name” “fieldprompt” “initial text” width “onselect macro”

Note: Width is 20 characters by default.Onselect macro defaults to “‘’“.

AddWizardSelboxItems

Use: Adds items to an existing wizard selection box.Command: none

Syntax: addwizardselboxitems “wizard name” “field name” {itemlist} position

Note: Item list is a string list.Position defaults to a value of -1.

AddWizardText

Use: Adds text to the wizard. When specifying the text, use \n to indicate anew line. You can also use \n to create an open space between controls.

Command: none

Syntax: addwizardtext “wizard name” “text”

Example: addwizardtext “wizard1” “select one of the following:”

Displays the text “Select one of the following:” on the wizard wizard1.

Page 254: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-26 Wizard Script Commands

AddWizardValidatorExpr

Use: Evaluates the specified expression when OK is chosen. This allows you touse a mathematical expression to test the values entered in the wizard’sfields. The expression may use variables defined by the wizard fields orbuttons. Use the mathematical functions listed at the beginning of thischapter for the expression. If the expression is valid, the wizard finishesrunning. If the expression is invalid, an error message appears and thewizard remains on the screen.

Command: none

Syntax: addwizardvalidatorexpr “wizard name” “validator id”“expression”

Example: addwizardvalidatorexpr “wizard1” “val1” “log (y)/2 ==0.5”

Evaluates the expression (log y)/2 = 0.5. If the expression is valid (y = 10)then the wizard disappears and the macro continues running. If theexpression is invalid (y does not equal 10), an error message appears andthe wizard remains displayed.

CreateWizard

Use: Creates a new wizard with the specified wizard name.Command: none

Syntax: createwizard “wizard name”

DeleteWizardValidatorExpr

Use: Deletes the validator created with the AddWizardValidatorExprcommand.

Command: none

Syntax: deletewizardvalidatorexpr “wizard name” “validator id”

DestroyWizard

Use: Removes the wizard and its variables from memory. A running wizardmust first be stopped.

Command: none

Syntax: destroywizard “wizard name”

☞Note: If the variable y is not defined, the expression cannot be evaluated and will

always display an error message.

Page 255: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-27

ExecWizard

Use: Executes the RunWizard, FileExec, and StopWizard commands. Themacro file can make use of any of the defined variables and only executesif the user exits the wizard by choosing OK.

Command: none

Syntax: execwizard “wizard name” “macro filename”

GetWizardRunResult

Use: Returns the result of the most recent RunWizard command for thespecified wizard.

Command: none

Syntax: getwizardrunresult “wizard name”

GetWizardSelboxIndex

Use: Returns the selection index from a wizard selection box.Command: none

Syntax: getwizardselboxindex “wizard name” “variable name”

Example: getwizardselboxindex “modelcolor” “red”

In this example, the software returns the index number assigned to red inthe modelcolor wizard. The index value is set using the SetWizardSel-boxIndex command.

GetWizardSelboxText

Use: Returns the text label from a wizard selection box.Command: none

Syntax: getwizardselboxtext “wizard name” “field name”

IsWizardControlChecked

Use: Checks the status of the variables that identify a button defined by thewizard. This command returns a value of 0 if the variable is anythingother than a radio button or checkbox. For a radio button or checkbox, itreturns a 1 if checked, 0 if unchecked. This command only works when awizard is running and displayed.

Command: none

Syntax: iswizardcontrolchecked “wizard name” “variable name”

Page 256: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-28 Wizard Script Commands

RunWizard

Use: Starts the wizard window using the interface features defined for thespecified wizard and sets the initial state of the buttons or fields in thewizard. The script commands that create the interface features and thewizard must precede this command.

Command: none

Syntax: runwizard “wizard name” {“variable:state”}“optional initalizer command”

Note: variable: The variable of the state initializer.state: These are state initializers. Use one of the following states:

checkdisablehide

Example: assign status runwizard “setup1” {“num_passes:disable”“n_modes:disable”} “setwizardcontrolstate” “wizard1”“box” 0 1 0

Runs the wizard setup1 and initially disables the fields or buttons associ-ated with the variables num_passes and n_modes. It also invokes the Set-WizardControlState which disables the button identified by the variablename box in the wizard named wizard1 command upon initialization.The variable status indicates whether the user chose OK or Cancel.

☞Note: The wizard is still considered to be running after the user chooses OK from

the window displayed by the wizard. The return value from the wizardindicates whether the user has selected OK (return value = 1) or Cancel(return value =0).

Once OK is selected, the wizard variables are automatically assigned. Ifvariables are currently defined that match variables the wizard is trying tocreate, the macro stops with an error.

You do not need to use StopWizard when Cancel is selected.

Page 257: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-29

SetWizardControlState

Use: Changes the state of a button. For example you can make a buttondisabled or enabled, visible or invisible, or, for checkboxes and radiobuttons, checked or unchecked. This command can only be used whenthe wizard’s interface is displayed. Because of this, it can only be used asan action in the AddWizardButtons command, or in a RunWizardinitializer.

Command: none

Syntax: setwizardcontrolstate “wizard name” “variable name”enabled visible checked

Note: enabled: 0=disabled, 1=enabledvisible: 0=invisible, 1=visiblechecked: 0=unchecked, 1=checked

Example: setwizardcontrolstate “wizard1” “box” 0 1 0

This example disables the button identified by the variable name box inthe wizard wizard1. The variable name must match that of a button orfield created with the AddWizardButtons or AddWizardField commandsyou wish to change the state of.

SetWizardControlText

Use: Changes the text of a button or edit field. This command can only be usedwhen the wizard’s interface is displayed. Because of this, it can only beused as an action in the AddWizardButtons command, or in a RunWizardinitializer.

Command: none

Syntax: setwizardcontroltext “wizard name” “variable name”“text”

Example: addwizardbuttons “input_geo” “push” 20 {“variable1”}{“box”} {“setwizardcontroltext ‘input_geo’ ‘variable1’‘button pressed’"} “horizontal”

This example creates a horizontal push button labeled Box in the wizard’sinterface. When pressed, the button label changes to Button Pressed. Thisexample is only meant as a demonstration of the command, and is not ausable routine.

Page 258: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-30 Wizard Script Commands

SetWizardFieldChoices

Use: Sets the acceptable values that a user may enter in a field. These values donot appear in the interface; use the SetWizardFieldDefault command tovisually indicate the acceptable values for a field. If the user enters avalue that is not specified by SetWizardFieldChoices, an error messageappears when OK is selected.

Command: none

Syntax: setwizardfieldchoices “wizard name” “variable name”{“choice1” “choice2” ... }

Example: setwizardfieldchoices “input_geo” “x_size” {“10” “20”“30”}

This example defines the acceptable values for the field assigned the vari-able x_size as 10, 20, and 30 in the wizard input_geo.

SetWizardFieldDefault

Use: Sets the initial value for a specified field. The value will appear in thatfield in the wizard.

Command: none

Syntax: setwizardfielddefault “wizard name” “variable name”“command expression”

Note: command expression: The command expression can be any value orsingle script command that resolves to a literal constant. The results of thescript command are displayed as the initial value for the field.

Example: setwizardfielddefault “input_geo” “width” “(sub temp110)”

Sets the default value for the field identified by the variable width to theresults of subtracting 10 from the variable temp1.

SetWizardFieldPrompt

Use: Changes the runtime prompt text for edit controls in a wizard panel.Command: none

Syntax: setwizardfieldprompt “wizard name” “field name”“prompt”

Example: setwizardfieldprompt “inputcur” “current” “enter thecurrent value.”

This example prompt the user to enter the current value in the currentfield name for the wizard named inputcur.

Page 259: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

Wizard Script Commands 11-31

SetWizardFieldRange

Use: Sets the acceptable range of values that a user may enter in a field. Thesevalues do not appear in the interface. Use the SetWizardFieldDefaultcommand to visually indicate the acceptable values for a field. If the userenters a value that is not in the range specified by SetWizardFieldRange,an error message appears when OK is pressed.

Command: none

Syntax: setwizardfieldrange “wizard name” “variable name”min_value max_value

Example: setwizardfieldrange “input_geo” “x_size” 10 50

Defines an acceptable range of values between 10 and 50 for the fieldassigned the variable x_size in the wizard input_geo.

SetWizardSelboxIndex

Use: Defines the selection by index for a wizard selection box.Command: none

Syntax: setwizardselboxindex “wizard name” “variable name”item_index

Note: item_index: Starting at 0, this value corresponds to an item in theselection box.

Example: setwizardselboxindex “modelcolor” “red” 2

This example assigns an index number of 2 to correspond to red in theselection box for the modelcolor wizard.

SetWizardTitle

Use: Sets the title of the window that appears when the wizard is invoked.Command: none

Syntax: setwizardtitle “wizard name” “title”

StopWizard

Use: Deletes the variables created with the wizard. It does not delete thewizard definition, so you can use RunWizard to run the wizard againafter using this command.

Command: none

Syntax: stopwizard “wizard name”

Page 260: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Wizard Example

11-32 Wizard Script Commands

Page 261: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

A-1

A

Module Script Commands

This appendix lists the script commands available in each module.

Page 262: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Commands Window Script Commands

A-2

Exe

cuti

ve C

om

man

ds

Win

do

w S

crip

t C

om

man

ds

(con

tinu

ed o

n ne

xt p

age)

Gen

eric

Mod

ule

mod

3pro

jm

od3v

iew

Def

ault

Cas

cad

eAll

Cas

cad

ePro

ject

sC

asca

deV

iew

sC

lose

Win

dow

Mod

uleI

sPro

mpt

Vis

ible

Mod

uleP

refs

Rev

ert

Mod

uleS

aveP

refs

Mod

uleS

idew

inL

eft

Mod

uleS

idew

inR

ight

Mod

uleT

oggl

eMes

sage

Mod

uleT

oggl

ePro

mpt

Mod

uleT

oolb

ar(d

irec

tion

)M

odul

eToo

lbar

Hid

eN

ewW

ind

owPr

intE

ntir

ePr

intP

roj

Prin

tRec

tPr

intS

ubw

inPr

intV

iew

Tile

AllG

rid

Tile

AllH

rzT

ileA

llVrt

Tile

Proj

ects

Gri

dT

ilePr

ojec

tsH

rzT

ilePr

ojec

tsV

rtT

ileV

iew

sGri

dT

ileV

iew

sHrz

Tile

Vie

wsV

rt

Abo

rtT

imeo

utA

ctiv

ateV

iew

Che

ckO

verl

apD

elet

eCS

Des

elec

tD

ispS

had

edD

ispW

ire

Flus

hEve

nts

Get

Cur

Pos

Get

Dou

ble

“Pro

mpt

”G

etL

ong

“Pro

mpt

”G

etN

umO

bjec

tsG

etN

umV

iew

sG

etO

bjec

tNam

eG

etO

rigi

nG

etPo

siti

on “

Prom

pt”

Get

Stri

ng “

Prom

pt”

Get

Uni

tCon

vG

etU

nitN

ame

Get

Vec

tor

“Pro

mpt

”G

loba

lCS

Hid

eH

ideO

rien

tH

ideR

egio

nH

ideS

elL

ist

Loc

alC

SL

orig

inO

bjec

tCS

Obj

ectE

xist

sO

rigi

n

Ori

gin?

Prin

tPro

jPr

intV

iew

Rec

olor

Res

tore

CS

Rot

ateC

SR

otat

edC

SSa

veC

md

Win

Save

CS

Save

Win

dow

Sele

ctSe

lInB

oxSe

tCur

Pos

SetO

bjec

tCS

Show

Show

All

Show

Ori

ent

Show

Reg

ion

Tog

gleR

egio

nU

nrot

ated

CS

Ver

ifyR

egio

nV

isB

yIte

mX

Axi

sAbo

utT

oX

Axi

sTo

XU

nitV

ec?

YA

xisA

bout

To

YA

xisT

oY

Uni

tVec

?Z

Axi

sAbo

utT

oZ

Axi

sTo

ZU

nitV

ec?

Aut

oGri

dFi

tAll

FitA

llVie

ws

FitS

elL

ooka

tO

rtho

Pers

pPo

larG

rid

Rec

tGri

dR

eset

Vie

ws

Rot

Vie

wSh

aded

Vie

wpo

int

Wir

efra

me

Ad

dA

ssig

nC

lear

All

Cle

arFu

ncti

ons

Cle

arV

ars

Com

plex

Form

atC

ompo

nent

Com

pone

ntC

ount

Dat

abas

eAd

dR

owD

atab

aseG

etC

olum

nsD

atab

aseG

etFi

eld

Dat

abas

eGet

Row

sD

atab

aseS

etFi

eld

Del

eteD

atab

ase

Div

Dou

bleL

istS

etC

ompo

nent

Dum

pDat

abas

eE

cho

EQ

Err

orE

valu

ateE

xpre

ssio

nE

xpor

tDat

abas

eFi

leC

lose

File

Exe

cFi

leE

xecE

rrE

xitI

fFi

leE

xecP

ause

File

Exi

sts

File

Ope

nFi

leR

ead

File

Rec

ord

File

Rec

ord

App

end

File

Rec

Stop

File

Wri

teFu

ncD

efFu

ncH

elp

Func

Save

Func

Und

efG

EG

etD

ateA

ndT

ime

Get

File

Lis

tG

etFi

leN

ame

Get

Mac

roPa

thG

etM

acro

Path

Lis

tG

etPr

oduc

tId

Get

Use

rOpt

ion

Get

Ver

sion

Glo

bal

Glo

balA

ssig

nG

TH

elp

Impo

rtD

atab

ase

Impo

rtR

awD

atab

ase

IsC

omm

and

Ena

bled

LE

Log

10L

TM

inus

Mul

NE

New

Dat

abas

eO

RPa

ram

etri

cFile

Exe

cPo

s2Po

s3Po

s3D

ist

Prep

end

Mac

roPa

thPr

intH

elp

Priv

ateA

ssig

nPr

otec

ted

Ass

ign

Ran

dom

Frac

tion

Rem

oveM

acro

Path

SetE

choE

nabl

edSe

tMac

roPa

thL

ist

SetR

ecor

din

gEna

bled

SetU

nits

OfQ

uant

SetU

serO

ptio

nSl

eep

StrC

onca

tSt

ring

Stri

ngL

istS

etC

ompo

nent

Strl

enSt

rstr

Sub

Subs

trin

gU

nass

ign

Vec

2V

ec3

XO

R

Page 263: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Executive Commands Window Script Commands

A-3

Exe

cuti

ve C

om

man

ds

Win

do

w S

crip

t C

om

man

ds

(con

tinu

ed)

HFS

SE

mis

sion

sSo

lve

Setu

p

Em

issi

onsS

etup

Lau

nchB

ound

arie

sL

aunc

hIm

ped

Onl

yL

aunc

hMat

eria

lsL

aunc

hMod

eler

Post

Fiel

ds

Post

Mat

rixD

ata

Post

Mat

rixP

lot

Proj

Dir

Proj

Nam

eSe

lect

Solu

tion

Typ

eSo

lveN

omin

alSo

lveS

etup

Em

issi

onsA

dd

Tes

tE

mis

sion

sDel

eteT

est

Em

issi

onsM

odif

yTes

tR

ollb

ackE

dit

able

Em

Parm

sSa

veE

dit

able

Em

Parm

sSe

tupE

dit

able

Em

Parm

s

Cle

arA

llDif

fere

ntia

lPai

rsD

efin

eDif

fere

ntia

lPai

rE

xitD

iffP

airs

Exi

tSol

veSe

tup

Get

Eig

enFr

eqG

etE

igen

Las

tSol

nOfT

ype

Get

Eig

enM

odeC

ount

Get

Eig

enN

umSo

lns

Get

Eig

enSo

lnN

ame

Get

Min

Ad

apti

vePa

sses

Rol

lbac

kEd

itab

leSo

lveP

arm

sSa

veE

dit

able

Solv

ePar

ms

SetA

dap

tive

Info

SetC

onvD

elta

SetC

onvM

atri

xSe

tEig

enm

odeI

nfo

SetE

xplic

itFr

eqs

SetF

requ

ency

SetF

requ

ency

Uni

tSe

tIni

tial

Mes

hRef

inem

ent

SetI

nter

pola

tion

Info

SetM

eshT

ype

SetM

inA

dap

tive

Pass

esSe

tSol

utio

nTyp

eSe

tSol

verC

ompu

tati

onSe

tSw

eepI

nfo

Setu

pEd

itab

leSo

lveP

arm

s

Page 264: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands

A-4

3D M

od

eler

Scr

ipt

Co

mm

and

s(c

onti

nued

on

next

pag

e)

Def

ault

Mod

eler

3

Ad

dA

ssig

nC

lear

All

Cle

arFu

ncti

ons

Cle

arV

ars

Com

plex

Form

atC

ompo

nent

Com

pone

ntC

ount

Dat

abas

eAd

dR

owD

atab

aseG

etC

olum

nsD

atab

aseG

etFi

eld

Dat

abas

eGet

Row

sD

atab

aseS

etFi

eld

Del

eteD

atab

ase

Div

Dou

bleL

istS

etC

ompo

nent

Dum

pDat

abas

eE

cho

EQ

Err

orE

valu

ateE

xpre

ssio

nE

xpor

tDat

abas

eFi

leC

lose

File

Exe

cFi

leE

xecE

rrE

xitI

fFi

leE

xecP

ause

File

Exi

sts

File

Ope

nFi

leR

ead

File

Rec

ord

File

Rec

ord

App

end

File

Rec

Stop

File

Wri

teFu

ncD

efFu

ncH

elp

Func

Save

Func

Und

efG

EG

etD

ateA

ndT

ime

Get

File

Lis

tG

etFi

leN

ame

Get

Mac

roPa

thG

etM

acro

Path

Lis

tG

etPr

oduc

tId

Get

Use

rOpt

ion

Get

Ver

sion

Glo

bal

Glo

balA

ssig

nG

TH

elp

Impo

rtD

atab

ase

Impo

rtR

awD

atab

ase

IsC

omm

and

Ena

bled

LE

Log

10L

TM

inus

Mul

NE

New

Dat

abas

eO

RPa

ram

etri

cFile

Exe

cPo

s2Po

s3Po

s3D

ist

Prep

end

Mac

roPa

thPr

intH

elp

Priv

ateA

ssig

nPr

otec

ted

Ass

ign

Ran

dom

Frac

tion

Rem

oveM

acro

Path

SetE

choE

nabl

edSe

tMac

roPa

thL

ist

SetR

ecor

din

gEna

bled

SetU

nits

OfQ

uant

SetU

serO

ptio

nSl

eep

StrC

onca

tSt

ring

Stri

ngL

istS

etC

ompo

nent

Strl

enSt

rstr

Sub

Subs

trin

gU

nass

ign

Vec

2V

ec3

XO

R

Ad

dV

ert

Ad

dV

ert3

DA

rcB

oxC

ance

lPlin

eC

ircl

eC

lose

3dC

lose

Plin

eC

olor

Face

sC

olor

Sel

Con

nect

Cov

erO

utl

Cov

erSh

eets

Cre

ateA

rcC

ylD

efC

olor

def

colo

r?D

elE

dge

Del

ete

Del

Ver

tD

etac

hFac

esD

isab

lePl

ineS

titc

hD

upA

xis

Dup

Lin

eD

upM

irro

rE

dge

Geo

mE

dge

Mod

eE

dit

Plin

eE

nabl

ePlin

eSti

tch

End

Plin

eE

ndTa

ngen

tE

xit

Exp

Ass

ign

Exp

Cle

arE

xpD

elE

xpE

val

Exp

Inc

Exp

Loa

dE

xpSa

veFi

ndPl

ineV

ertN

oFi

tReg

ion

Get

Plin

eVer

tNo

Hel

ixH

ideR

egio

nIm

port

3dIn

sVer

tIn

ters

ect

Join

Splin

esM

irro

rM

ove

Mov

eArc

Mid

PtM

oveV

ert

New

3dO

penP

line

PML

Cov

erSe

tup

Poin

tPr

ojPr

efs

Rea

d2d

Rea

d3d

ReC

olor

Rec

tang

leR

edo

Reg

ion

ReN

ame

Res

etV

iew

sR

otat

e

Save

2dSa

ve3d

Save

SAT

Save

SLD

Scal

eSe

ctio

nSe

lCle

arSe

lCol

orSe

lCop

ySe

lCut

SelP

aste

SetA

rcA

ngle

SetA

rcR

adiu

sSe

tArc

toFi

llet

SetM

odel

SetN

onM

odel

SetS

ldTo

lSe

tUni

tsSh

owR

egio

nSp

litSp

litSp

line

Star

tTan

gent

Stit

chSu

btra

ctSw

eepA

xis

Swee

pPat

hSw

eepT

wis

tSw

eepV

ecU

ncov

erU

nDel

Und

oU

nite

Page 265: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Modeler Script Commands

A-5

3D M

od

eler

Scr

ipt

Co

mm

and

s(c

onti

nued

)

Gen

eric

Mod

ule

mod

3pro

jm

od3v

iew

Cas

cad

eAll

Cas

cad

ePro

ject

sC

asca

deV

iew

sC

lose

Win

dow

Mod

uleI

sPro

mpt

Vis

ible

Mod

uleP

refs

Rev

ert

Mod

uleS

aveP

refs

Mod

uleS

idew

inL

eft

Mod

uleS

idew

inR

ight

Mod

uleT

oggl

eMes

sage

Mod

uleT

oggl

ePro

mpt

Mod

uleT

oolb

ar(d

irec

tion

)M

odul

eToo

lbar

Hid

eN

ewW

ind

owPr

intE

ntir

ePr

intP

roj

Prin

tRec

tPr

intS

ubw

inPr

intV

iew

Tile

AllG

rid

Tile

AllH

rzT

ileA

llVrt

Tile

Proj

ects

Gri

dT

ilePr

ojec

tsH

rzT

ilePr

ojec

tsV

rtT

ileV

iew

sGri

dT

ileV

iew

sHrz

Tile

Vie

wsV

rt

Abo

rtT

imeo

utA

ctiv

ateV

iew

Che

ckO

verl

apD

elet

eCS

Des

elec

tD

ispS

had

edD

ispW

ire

Flus

hEve

nts

Get

Cur

Pos

Get

Dou

ble

“Pro

mpt

”G

etL

ong

“Pro

mpt

”G

etN

umO

bjec

tsG

etN

umV

iew

sG

etO

bjec

tNam

eG

etO

rigi

nG

etPo

siti

on “

Prom

pt”

Get

Stri

ng “

Prom

pt”

Get

Uni

tCon

vG

etU

nitN

ame

Get

Vec

tor

“Pro

mpt

”G

loba

lCS

Hid

eH

ideO

rien

tH

ideR

egio

nH

ideS

elL

ist

Loc

alC

SL

orig

inO

bjec

tCS

Obj

ectE

xist

sO

rigi

n

Ori

gin?

Prin

tPro

jPr

intV

iew

Rec

olor

Res

tore

CS

Rot

ateC

SR

otat

edC

SSa

veC

md

Win

Save

CS

Save

Win

dow

Sele

ctSe

lInB

oxSe

tCur

Pos

SetO

bjec

tCS

Show

Show

All

Show

Ori

ent

Show

Reg

ion

Tog

gleR

egio

nU

nrot

ated

CS

Ver

ifyR

egio

nV

isB

yIte

mX

Axi

sAbo

utT

oX

Axi

sTo

XU

nitV

ec?

YA

xisA

bout

To

YA

xisT

oY

Uni

tVec

?Z

Axi

sAbo

utT

oZ

Axi

sTo

ZU

nitV

ec?

Aut

oGri

dFi

tAll

FitA

llVie

ws

FitS

elL

ooka

tO

rtho

Pers

pPo

larG

rid

Rec

tGri

dR

eset

Vie

ws

Rot

Vie

wSh

aded

Vie

wpo

int

Wir

efra

me

Page 266: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Material Manager Script Commands

A-6

Mat

eria

l Man

ager

Scr

ipt

Co

mm

and

s(c

onti

nued

on

next

pag

e)

Def

ault

Mat

eria

lKer

nel

Ad

dA

ssig

nC

lear

All

Cle

arFu

ncti

ons

Cle

arV

ars

Com

plex

Form

atC

ompo

nent

Com

pone

ntC

ount

Dat

abas

eAd

dR

owD

atab

aseG

etC

olum

nsD

atab

aseG

etFi

eld

Dat

abas

eGet

Row

sD

atab

aseS

etFi

eld

Del

eteD

atab

ase

Div

Dou

bleL

istS

etC

ompo

nent

Dum

pDat

abas

eE

cho

EQ

Err

orE

valu

ateE

xpre

ssio

nE

xpor

tDat

abas

eFi

leC

lose

File

Exe

cFi

leE

xecE

rrE

xitI

fFi

leE

xecP

ause

File

Exi

sts

File

Ope

nFi

leR

ead

File

Rec

ord

File

Rec

ord

App

end

File

Rec

Stop

File

Wri

teFu

ncD

efFu

ncH

elp

Func

Save

Func

Und

efG

EG

etD

ateA

ndT

ime

Get

File

Lis

tG

etFi

leN

ame

Get

Mac

roPa

thG

etM

acro

Path

Lis

tG

etPr

oduc

tId

Get

Use

rOpt

ion

Get

Ver

sion

Glo

bal

Glo

balA

ssig

nG

TH

elp

Impo

rtD

atab

ase

Impo

rtR

awD

atab

ase

IsC

omm

and

Ena

bled

LE

Log

10L

TM

inus

Mul

NE

New

Dat

abas

eO

RPa

ram

etri

cFile

Exe

cPo

s2Po

s3

Pos3

Dis

tPr

epen

dM

acro

Path

Prin

tHel

pPr

ivat

eAss

ign

Prot

ecte

dA

ssig

nR

and

omFr

acti

onR

emov

eMac

roPa

thSe

tEch

oEna

bled

SetM

acro

Path

Lis

tSe

tRec

ord

ingE

nabl

edSe

tUni

tsO

fQua

ntSe

tUse

rOpt

ion

Slee

pSt

rCon

cat

Stri

ngSt

ring

Lis

tSet

Com

pone

ntSt

rlen

Strs

trSu

bSu

bstr

ing

Una

ssig

nV

ec2

Vec

3X

OR

Ed

itB

HC

urve

PML

Mat

Setu

pG

etSe

lect

edM

ater

ial

Mat

eria

lAcc

ept

Mat

eria

lAd

dM

ater

ialA

ssig

nM

ater

ialC

lear

Mat

eria

lDer

ive

Mat

eria

lMod

ifyF

unct

ion

Mat

eria

lPM

LSe

tup

Mat

eria

lRev

ert

Mat

eria

lSel

ect

Mat

eria

lSet

Prop

erty

Mat

eria

lSet

Typ

eM

ater

ialU

nder

ive

Obj

ectS

etSo

lveI

nsid

eO

bjec

tSet

Solv

eIns

ide

Save

Mat

eria

lDat

abas

e

Page 267: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Material Manager Script Commands

A-7

Mat

eria

l Man

ager

Scr

ipt

Co

mm

and

s(c

onti

nued

)

Gen

eric

Mod

ule

mod

3pro

jm

od3v

iew

Cas

cad

eAll

Cas

cad

ePro

ject

sC

asca

deV

iew

sC

lose

Win

dow

Mod

uleI

sPro

mpt

Vis

ible

Mod

uleP

refs

Rev

ert

Mod

uleS

aveP

refs

Mod

uleS

idew

inL

eft

Mod

uleS

idew

inR

ight

Mod

uleT

oggl

eMes

sage

Mod

uleT

oggl

ePro

mpt

Mod

uleT

oolb

ar(d

irec

tion

)M

odul

eToo

lbar

Hid

eN

ewW

ind

owPr

intE

ntir

ePr

intP

roj

Prin

tRec

tPr

intS

ubw

inPr

intV

iew

Tile

AllG

rid

Tile

AllH

rzT

ileA

llVrt

Tile

Proj

ects

Gri

dT

ilePr

ojec

tsH

rzT

ilePr

ojec

tsV

rtT

ileV

iew

sGri

dT

ileV

iew

sHrz

Tile

Vie

wsV

rt

Abo

rtT

imeo

utA

ctiv

ateV

iew

Che

ckO

verl

apD

elet

eCS

Des

elec

tD

ispS

had

edD

ispW

ire

Flus

hEve

nts

Get

Cur

Pos

Get

Dou

ble

“Pro

mpt

”G

etL

ong

“Pro

mpt

”G

etN

umO

bjec

tsG

etN

umV

iew

sG

etO

bjec

tNam

eG

etO

rigi

nG

etPo

siti

on “

Prom

pt”

Get

Stri

ng “

Prom

pt”

Get

Uni

tCon

vG

etU

nitN

ame

Get

Vec

tor

“Pro

mpt

”G

loba

lCS

Hid

eH

ideO

rien

tH

ideR

egio

nH

ideS

elL

ist

Loc

alC

SL

orig

inO

bjec

tCS

Obj

ectE

xist

sO

rigi

n

Ori

gin?

Prin

tPro

jPr

intV

iew

Rec

olor

Res

tore

CS

Rot

ateC

SR

otat

edC

SSa

veC

md

Win

Save

CS

Save

Win

dow

Sele

ctSe

lInB

oxSe

tCur

Pos

SetO

bjec

tCS

Show

Show

All

Show

Ori

ent

Show

Reg

ion

Tog

gleR

egio

nU

nrot

ated

CS

Ver

ifyR

egio

nV

isB

yIte

mX

Axi

sAbo

utT

oX

Axi

sTo

XU

nitV

ec?

YA

xisA

bout

To

YA

xisT

oY

Uni

tVec

?Z

Axi

sAbo

utT

oZ

Axi

sTo

ZU

nitV

ec?

Aut

oGri

dFi

tAll

FitA

llVie

ws

FitS

elL

ooka

tO

rtho

Pers

pPo

larG

rid

Rec

tGri

dR

eset

Vie

ws

Rot

Vie

wSh

aded

Vie

wpo

int

Wir

efra

me

Page 268: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Boundary Manager Script Commands

A-8

3D B

ou

nd

ary

Man

ager

Scr

ipt

Co

mm

and

s(c

onti

nued

on

next

pag

e)

Def

ault

Bou

ndar

y M

odul

eB

ound

ary

Ker

nel

Ad

dA

ssig

nC

lear

All

Cle

arFu

ncti

ons

Cle

arV

ars

Com

plex

Form

atC

ompo

nent

Com

pone

ntC

ount

Dat

abas

eAd

dR

owD

atab

aseG

etC

olum

nsD

atab

aseG

etFi

eld

Dat

abas

eGet

Row

sD

atab

aseS

etFi

eld

Del

eteD

atab

ase

Div

Dou

bleL

istS

etC

ompo

nent

Dum

pDat

abas

eE

cho

EQ

Err

orE

valu

ateE

xpre

ssio

nE

xpor

tDat

abas

eFi

leC

lose

File

Exe

cFi

leE

xecE

rrE

xitI

fFi

leE

xecP

ause

File

Exi

sts

File

Ope

nFi

leR

ead

File

Rec

ord

File

Rec

ord

App

end

File

Rec

Stop

File

Wri

teFu

ncD

efFu

ncH

elp

Func

Save

Func

Und

efG

EG

etD

ateA

ndT

ime

Get

File

Lis

tG

etFi

leN

ame

Get

Mac

roPa

thG

etM

acro

Path

Lis

tG

etPr

oduc

tId

Get

Use

rOpt

ion

Get

Ver

sion

Glo

bal

Glo

balA

ssig

nG

TH

elp

Impo

rtD

atab

ase

Impo

rtR

awD

atab

ase

IsC

omm

and

Ena

bled

LE

Log

10L

TM

inus

Mul

NE

New

Dat

abas

eO

RPa

ram

etri

cFile

Exe

cPo

s2Po

s3

Pos3

Dis

tPr

epen

dM

acro

Path

Prin

tHel

pPr

ivat

eAss

ign

Prot

ecte

dA

ssig

nR

and

omFr

acti

onR

emov

eMac

roPa

thSe

tEch

oEna

bled

SetM

acro

Path

Lis

tSe

tRec

ord

ingE

nabl

edSe

tUni

tsO

fQua

ntSe

tUse

rOpt

ion

Slee

pSt

rCon

cat

Stri

ngSt

ring

Lis

tSet

Com

pone

ntSt

rlen

Strs

trSu

bSu

bstr

ing

Una

ssig

nV

ec2

Vec

3X

OR

Def

ineB

ndFu

ncs

Exi

tBou

ndar

ies

Save

Bou

ndar

ies

Sele

ctB

yNam

eSe

lect

Face

sInt

erse

ctio

nSe

tDef

ault

Uni

tsT

oggl

eVie

wB

ndV

is

Bou

ndar

yMod

ifyF

unct

ion

Cle

arA

llBnd

sC

lear

Sele

ctio

nN

eed

Cal

ibL

ine

Nee

dIm

ped

Lin

ePi

ckFa

ceB

yId

Pick

Face

ByR

ayPo

lari

zeE

Fiel

dR

enam

ePor

tsR

epri

orit

izeS

elB

ound

ary

Sele

ctO

bjB

yNam

eSe

lect

Obj

Face

sSe

tAllB

ndU

nits

ToC

urre

ntSe

tBnd

Nam

eSe

tBnd

Uni

tsT

oCur

rent

SetB

oole

anSe

tBou

ndar

ySe

tCal

ibL

ineE

ndSe

tCal

ibL

ineS

tart

SetC

oord

Syst

emSe

tCur

rent

Flow

Lin

eEnd

SetC

urre

ntFl

owL

ineS

tart

SetE

ndpo

int

SetI

mpe

dan

ceM

ulti

plie

rSe

tIm

ped

Lin

eEnd

SetI

mpe

dL

ineS

tart

SetL

umpe

dPo

rtSe

tNum

OfM

odes

SetO

rigi

nSe

tRL

CT

ype

SetS

cala

rSe

tSca

larF

orSe

tSta

rtPo

int

SetS

trin

gFor

SetU

poin

tSe

tVpo

int

Swap

Boo

lean

Tog

gleP

ickB

ndB

yNam

eT

oggl

ePic

kBnd

ByR

ayT

oggl

ePic

kObj

ByN

ame

Tog

gleP

ickO

bjB

yRay

Tog

gleP

ickO

bjO

bjIn

tU

ndoC

lear

Page 269: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Boundary Manager Script Commands

A-9

3D B

ou

nd

ary

Man

ager

Scr

ipt

Co

mm

and

s(c

onti

nued

)

Gen

eric

Mod

ule

mod

3pro

jm

od3v

iew

Cas

cad

eAll

Cas

cad

ePro

ject

sC

asca

deV

iew

sC

lose

Win

dow

Mod

uleI

sPro

mpt

Vis

ible

Mod

uleP

refs

Rev

ert

Mod

uleS

aveP

refs

Mod

uleS

idew

inL

eft

Mod

uleS

idew

inR

ight

Mod

uleT

oggl

eMes

sage

Mod

uleT

oggl

ePro

mpt

Mod

uleT

oolb

ar(d

irec

tion

)M

odul

eToo

lbar

Hid

eN

ewW

ind

owPr

intE

ntir

ePr

intP

roj

Prin

tRec

tPr

intS

ubw

inPr

intV

iew

Tile

AllG

rid

Tile

AllH

rzT

ileA

llVrt

Tile

Proj

ects

Gri

dT

ilePr

ojec

tsH

rzT

ilePr

ojec

tsV

rtT

ileV

iew

sGri

dT

ileV

iew

sHrz

Tile

Vie

wsV

rt

Abo

rtT

imeo

utA

ctiv

ateV

iew

Che

ckO

verl

apD

elet

eCS

Des

elec

tD

ispS

had

edD

ispW

ire

Flus

hEve

nts

Get

Cur

Pos

Get

Dou

ble

“Pro

mpt

”G

etL

ong

“Pro

mpt

”G

etN

umO

bjec

tsG

etN

umV

iew

sG

etO

bjec

tNam

eG

etO

rigi

nG

etPo

siti

on “

Prom

pt”

Get

Stri

ng “

Prom

pt”

Get

Uni

tCon

vG

etU

nitN

ame

Get

Vec

tor

“Pro

mpt

”G

loba

lCS

Hid

eH

ideO

rien

tH

ideR

egio

nH

ideS

elL

ist

Loc

alC

SL

orig

inO

bjec

tCS

Obj

ectE

xist

sO

rigi

n

Ori

gin?

Prin

tPro

jPr

intV

iew

Rec

olor

Res

tore

CS

Rot

ateC

SR

otat

edC

SSa

veC

md

Win

Save

CS

Save

Win

dow

Sele

ctSe

lInB

oxSe

tCur

Pos

SetO

bjec

tCS

Show

Show

All

Show

Ori

ent

Show

Reg

ion

Tog

gleR

egio

nU

nrot

ated

CS

Ver

ifyR

egio

nV

isB

yIte

mX

Axi

sAbo

utT

oX

Axi

sTo

XU

nitV

ec?

YA

xisA

bout

To

YA

xisT

oY

Uni

tVec

?Z

Axi

sAbo

utT

oZ

Axi

sTo

ZU

nitV

ec?

Aut

oGri

dFi

tAll

FitA

llVie

ws

FitS

elL

ooka

tO

rtho

Pers

pPo

larG

rid

Rec

tGri

dR

eset

Vie

ws

Rot

Vie

wSh

aded

Vie

wpo

int

Wir

efra

me

Page 270: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Meshmaker Script Commands

A-10

Mes

hm

aker

Scr

ipt

Co

mm

and

s

Mes

h3D

Gen

eric

Mod

ule

mod

3pro

jm

od3v

iew

Clo

sePr

ojec

tD

elet

eAllS

eed

Del

eteA

llSee

dN

onIn

tera

ctiv

ely

Del

eteM

esh

Del

SelF

aces

DeS

elB

odie

sD

oMod

elA

naly

sis

Exi

tFu

rthe

rIm

prov

eQua

lity

GE

xit

GW

rite

Mes

hH

idd

enL

ineO

ffH

idd

enL

ineO

nH

idd

enL

ineO

nOff

Hid

eAll

Hid

eMes

hIm

prov

eQua

lity

Impr

oveS

urfT

riIn

tera

ctiv

eDel

eteM

esh

Inte

ract

iveM

akeI

nitM

esh

Mak

eIni

tial

Mes

hM

eshD

ispl

ayM

ode

Mes

hInf

oM

odel

Alo

neN

ewPr

ojec

t

Non

Inte

ract

iveD

elet

eMes

hO

penP

roje

ctPu

llPoi

ntsT

oTru

eSur

face

sR

efre

shV

iew

Save

Seed

Save

Win

dow

Seed

ingI

nfo

Seed

Ref

ineC

omm

and

ToK

erne

lSe

lect

One

Face

SelF

aces

SetB

oxSc

ope

SetD

ispl

ayO

nSe

tFac

eter

Ref

inem

ents

SetM

eshD

ispl

ayM

ode

SetT

riSc

ope

SetV

iew

Kin

dW

ireF

ram

eSh

aded

Mes

hSh

owH

ideM

esh

Show

Mes

hSh

owPo

ints

Show

Surf

Tri

Show

Tet

sSm

ooth

enM

esh

Wri

teM

esh

Wri

teM

eshA

s

Cas

cad

eAll

Cas

cad

ePro

ject

sC

asca

deV

iew

sC

lose

Win

dow

Mod

uleI

sPro

mpt

Vis

ible

Mod

uleP

refs

Rev

ert

Mod

uleS

aveP

refs

Mod

uleS

idew

inL

eft

Mod

uleS

idew

inR

ight

Mod

uleT

oggl

eMes

sage

Mod

uleT

oggl

ePro

mpt

Mod

uleT

oolb

ar(d

irec

tion

)M

odul

eToo

lbar

Hid

eN

ewW

ind

owPr

intE

ntir

ePr

intP

roj

Prin

tRec

tPr

intS

ubw

inPr

intV

iew

Tile

AllG

rid

Tile

AllH

rzT

ileA

llVrt

Tile

Proj

ects

Gri

dT

ilePr

ojec

tsH

rzT

ilePr

ojec

tsV

rtT

ileV

iew

sGri

dT

ileV

iew

sHrz

Tile

Vie

wsV

rt

Abo

rtT

imeo

utA

ctiv

ateV

iew

Che

ckO

verl

apD

elet

eCS

Des

elec

tD

ispS

had

edD

ispW

ire

Flus

hEve

nts

Get

Cur

Pos

Get

Dou

ble

“Pro

mpt

”G

etL

ong

“Pro

mpt

”G

etN

umO

bjec

tsG

etN

umV

iew

sG

etO

bjec

tNam

eG

etO

rigi

nG

etPo

siti

on “

Prom

pt”

Get

Stri

ng “

Prom

pt”

Get

Uni

tCon

vG

etU

nitN

ame

Get

Vec

tor

“Pro

mpt

”G

loba

lCS

Hid

eH

ideO

rien

tH

ideR

egio

nH

ideS

elL

ist

Loc

alC

SL

orig

inO

bjec

tCS

Obj

ectE

xist

sO

rigi

n

Ori

gin?

Prin

tPro

jPr

intV

iew

Rec

olor

Res

tore

CS

Rot

ateC

SR

otat

edC

SSa

veC

md

Win

Save

CS

Save

Win

dow

Sele

ctSe

lInB

oxSe

tCur

Pos

SetO

bjec

tCS

Show

Show

All

Show

Ori

ent

Show

Reg

ion

Tog

gleR

egio

nU

nrot

ated

CS

Ver

ifyR

egio

nV

isB

yIte

mX

Axi

sAbo

utT

oX

Axi

sTo

XU

nitV

ec?

YA

xisA

bout

To

YA

xisT

oY

Uni

tVec

?Z

Axi

sAbo

utT

oZ

Axi

sTo

ZU

nitV

ec?

Aut

oGri

dFi

tAll

FitA

llVie

ws

FitS

elL

ooka

tO

rtho

Pers

pPo

larG

rid

Rec

tGri

dR

eset

Vie

ws

Rot

Vie

wSh

aded

Vie

wpo

int

Wir

efra

me

Page 271: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Script Commands

A-11

3D P

ost

Pro

cess

or

Scr

ipt

Co

mm

and

s(c

onti

nued

on

next

pag

e)

Gen

eric

Mod

ule

HFS

SPo

st3D

Cas

cad

eAll

Cas

cad

ePro

ject

sC

asca

deV

iew

sC

lose

Win

dow

Mod

uleI

sPro

mpt

Vis

ible

Mod

uleP

refs

Rev

ert

Mod

uleS

aveP

refs

Mod

uleS

idew

inL

eft

Mod

uleS

idew

inR

ight

Mod

uleT

oggl

eMes

sage

Mod

uleT

oggl

ePro

mpt

Mod

uleT

oolb

ar(d

irec

tion

)M

odul

eToo

lbar

Hid

eN

ewW

ind

owPr

intE

ntir

ePr

intP

roj

Prin

tRec

tPr

intS

ubw

inPr

intV

iew

Tile

AllG

rid

Tile

AllH

rzT

ileA

llVrt

Tile

Proj

ects

Gri

dT

ilePr

ojec

tsH

rzT

ilePr

ojec

tsV

rtT

ileV

iew

sGri

dT

ileV

iew

sHrz

Tile

Vie

wsV

rt

Cle

arR

adia

ted

Fiel

ds

Com

pute

FarF

ield

Com

pute

Nea

rFie

ldC

ompu

teN

earF

ield

OnL

ines

Cre

ateF

arFi

eld

Plot

Cre

ateN

earF

ield

Plot

Cre

ateR

adFi

eld

Plot

Obj

ect

dB

Plot

Dis

play

FarF

ield

Dat

aD

ispl

ayN

earF

ield

Dat

aG

ener

ateF

ield

Plot

sG

etA

nten

naPa

ram

eter

Get

Rad

iate

dE

Fiel

dM

axPo

sG

etR

adia

ted

EFi

eld

Max

Val

Get

Rad

iate

dFi

eld

Qua

ntit

yL

oad

Rad

iate

dFi

eld

sPl

otN

orm

aliz

edR

eCom

pute

Fiel

ds

Save

Rad

iate

dFi

eld

sSc

aleS

ourc

eMag

nitu

de

SetC

ompl

exC

ompT

oPlo

tSe

tCur

rGeo

met

rySe

tLin

eInd

epV

aria

ble

SetL

ines

ToP

lotO

nSe

tNea

rFie

ldC

ompu

teG

eom

etry

SetP

hiV

alue

sSe

tPlo

tPhi

Val

ues

SetP

lotQ

uant

ity

SetP

lotT

heta

Val

ues

SetP

olar

izat

ionT

oPlo

tSe

tRad

iati

onSu

rfac

eSe

tSou

rceP

hase

SetS

pher

eFix

edV

arSe

tSph

ereR

adiu

sSe

tSph

eric

alPl

otT

ype

SetT

heta

Val

ues

Spec

ifyF

requ

ency

Upd

ateF

arFi

eld

Upd

ateN

earF

ield

Use

Tot

alFi

eld

Arr

owPl

otO

ptio

nsC

alcV

isT

oggl

eC

Hel

pC

lose

Proj

ect

Del

eteG

eom

etry

Del

eteP

lot

Dis

able

Plin

eSti

tch

Ed

itB

ound

Dis

play

Ed

itFu

ncti

ons

Exi

tFo

rmat

Plot

Axe

sFo

rmat

Plot

Gra

phs

Gen

eral

Plot

Opt

ions

Lin

ePlo

tOpt

ions

Lis

tPlo

tsPr

ojec

tL

istP

lots

Vie

ws

Loa

dC

arte

sian

3DPl

otM

arke

rPlo

tOpt

ions

Mod

ifyP

lot

Mod

ifyV

aria

bles

Ope

nPro

ject

Pane

lPlo

tDel

ete

Pane

lPlo

tVis

ibili

tyPo

stPr

oces

sorO

ptio

nsSa

veD

efin

itio

nsSh

owC

alc

Show

Plot

Coo

rdin

ates

Show

Solu

tion

Info

Tile

AllG

rid

Tile

Proj

ects

Gri

dT

ileV

iew

sGri

dT

oggl

ePlo

tVis

ibili

ty

Page 272: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Script Commands

A-12

3D P

ost

Pro

cess

or

Scr

ipt

Co

mm

and

s(c

onti

nued

on

next

pag

e)

mod

3pro

jm

od3v

iew

Def

ault

Abo

rtT

imeo

utA

ctiv

ateV

iew

Che

ckO

verl

apD

elet

eCS

Des

elec

tD

ispS

had

edD

ispW

ire

Flus

hEve

nts

Get

Cur

Pos

Get

Dou

ble

“Pro

mpt

”G

etL

ong

“Pro

mpt

”G

etN

umO

bjec

tsG

etN

umV

iew

sG

etO

bjec

tNam

eG

etO

rigi

nG

etPo

siti

on “

Prom

pt”

Get

Stri

ng “

Prom

pt”

Get

Uni

tCon

vG

etU

nitN

ame

Get

Vec

tor

“Pro

mpt

”G

loba

lCS

Hid

eH

ideO

rien

tH

ideR

egio

nH

ideS

elL

ist

Loc

alC

SL

orig

inO

bjec

tCS

Obj

ectE

xist

sO

rigi

n

Ori

gin?

Prin

tPro

jPr

intV

iew

Rec

olor

Res

tore

CS

Rot

ateC

SR

otat

edC

SSa

veC

md

Win

Save

CS

Save

Win

dow

Sele

ctSe

lInB

oxSe

tCur

Pos

SetO

bjec

tCS

Show

Show

All

Show

Ori

ent

Show

Reg

ion

Tog

gleR

egio

nU

nrot

ated

CS

Ver

ifyR

egio

nV

isB

yIte

mX

Axi

sAbo

utT

oX

Axi

sTo

XU

nitV

ec?

YA

xisA

bout

To

YA

xisT

oY

Uni

tVec

?Z

Axi

sAbo

utT

oZ

Axi

sTo

ZU

nitV

ec?

Aut

oGri

dFi

tAll

FitA

llVie

ws

FitS

elL

ooka

tO

rtho

Pers

pPo

larG

rid

Rec

tGri

dR

eset

Vie

ws

Rot

Vie

wSh

aded

Vie

wpo

int

Wir

efra

me

Ad

dA

ssig

nC

lear

All

Cle

arFu

ncti

ons

Cle

arV

ars

Com

plex

Form

atC

ompo

nent

Com

pone

ntC

ount

Dat

abas

eAd

dR

owD

atab

aseG

etC

olum

nsD

atab

aseG

etFi

eld

Dat

abas

eGet

Row

sD

atab

aseS

etFi

eld

Del

eteD

atab

ase

Div

Dou

bleL

istS

etC

ompo

nent

Dum

pDat

abas

eE

cho

EQ

Err

orE

valu

ateE

xpre

ssio

nE

xpor

tDat

abas

eFi

leC

lose

File

Exe

cFi

leE

xecE

rrE

xitI

fFi

leE

xecP

ause

File

Exi

sts

File

Ope

nFi

leR

ead

File

Rec

ord

File

Rec

ord

App

end

File

Rec

Stop

File

Wri

teFu

ncD

efFu

ncH

elp

Func

Save

Func

Und

efG

EG

etD

ateA

ndT

ime

Get

File

Lis

tG

etFi

leN

ame

Get

Mac

roPa

thG

etM

acro

Path

Lis

tG

etPr

oduc

tId

Get

Use

rOpt

ion

Get

Ver

sion

Glo

bal

Glo

balA

ssig

nG

TH

elp

Impo

rtD

atab

ase

Impo

rtR

awD

atab

ase

IsC

omm

and

Ena

bled

LE

Log

10L

TM

inus

Mul

NE

New

Dat

abas

eO

RPa

ram

etri

cFile

Exe

cPo

s2Po

s3

Pos3

Dis

tPr

epen

dM

acro

Path

Prin

tHel

pPr

ivat

eAss

ign

Prot

ecte

dA

ssig

nR

and

omFr

acti

onR

emov

eMac

roPa

thSe

tEch

oEna

bled

SetM

acro

Path

Lis

tSe

tRec

ord

ingE

nabl

edSe

tUni

tsO

fQua

ntSe

tUse

rOpt

ion

Slee

pSt

rCon

cat

Stri

ngSt

ring

Lis

tSet

Com

pone

ntSt

rlen

Strs

trSu

bSu

bstr

ing

Una

ssig

nV

ec2

Vec

3X

OR

Page 273: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

3D Post Processor Script Commands

A-13

3D P

ost

Pro

cess

or

Scr

ipt

Co

mm

and

s(c

onti

nued

)

Plot

3D

Fiel

dC

alcu

lato

r

Gra

ph3d

SetC

olor

Gra

ph3d

SetF

illed

Gra

ph3d

SetL

ine

Gra

ph3d

SetO

utlin

eG

raph

3dSe

tRef

inem

ent

Gra

ph3d

SetS

had

eG

raph

3DSe

tTon

eSha

ded

Gra

ph3d

Upd

ateG

raph

Plot

3dD

raw

Axe

sPl

ot3d

Dra

wG

rid

Plot

3dSe

tAxe

sLab

elSi

zePl

ot3d

SetC

olor

Map

Plot

3dSe

tHea

dE

xtru

sion

Plot

3dSe

tHea

din

gPl

ot3d

SetH

ead

ingC

olor

Plot

3dSe

tHea

din

gFon

tPl

ot3d

SetH

ead

ingS

ize

Plot

3dSe

tLig

htin

gPl

ot3d

SetS

cale

Plot

3dSh

owC

olor

Key

Plot

3dU

pdat

ePlo

ts

*(M

ulti

ply)

+(A

dd

)–

(Sub

trac

t)/

(Div

ide)

1/ Abs

Ad

dFa

ceA

tPos

Ad

dFa

ceW

ithI

dA

dd

Obj

ectT

oLis

tA

nim

atio

nAd

dFr

ame

Ani

mat

ionD

elet

eFra

me

Ani

mat

ionM

oveF

ram

eA

nim

atio

nPla

yA

nim

atio

nPlo

tA

nim

atio

nSav

eFra

mes

Ani

mat

ionS

aveP

lot

Ani

mat

ionS

etD

elta

Val

Ani

mat

ionS

etPl

ayT

ime

Ani

mat

ionS

etR

efin

emen

tA

nim

atio

nSet

Star

tVal

Ani

mat

ionS

etSt

opV

alA

nim

atio

nSet

Stor

eFra

me

Ani

mat

ionS

etV

arN

ame

Ani

mat

ionS

how

Fram

eA

rcC

reat

eA

tPha

seB

HPl

otB

uild

Plot

Info

Cle

arC

mpl

xIC

mpl

xMag

Cm

plxR

Con

jC

reat

eAni

mat

ion

Cre

ateF

aces

Lis

tC

reat

eBH

Plot

Cre

ateP

lot

Cro

ssC

url

Cut

Plan

eCre

ate

Cut

Plan

eMod

ify

D/

Dx

D/

Dy

D/

Dz

Defi

neC

utPl

ane

Defi

neE

xter

nalF

ace

Def

ineE

xter

nalF

ace

Def

ineF

aces

Lis

tD

efin

eFun

ctio

nD

efin

eObj

ectL

ist

Def

ineP

oint

Del

eteL

ine

Del

eteP

lot

Del

eteP

oint

Del

eteS

urfa

ceD

elet

eVol

ume

Del

taM

odif

yCut

Plan

eD

elta

Mod

ifyP

oint

Div

gD

omai

nD

otD

raw

Dra

wL

ine

Dra

wSu

rfac

eD

raw

Vol

ume

Ent

erE

nter

Com

plex

Ent

erC

ompl

exV

ecto

rE

nter

Freq

uenc

yE

nter

Lin

eE

nter

Poin

tE

nter

Scal

arE

nter

Scal

arFu

ncti

onE

nter

Surf

ace

Ent

erV

ecto

rE

nter

Vec

torF

unct

ion

Ent

erV

olum

eE

valu

ate

Exc

hang

eE

xpor

tToF

ileE

xpor

tToV

olum

eGri

dFa

cesL

istM

odif

yFu

ncti

onV

alue

Get

Top

Ent

ryV

alue

Gra

dIm

agIn

tegr

ate

IsoS

urfa

ceL

ineC

reat

eL

ineM

odif

yL

ineP

lot

Lin

ePlo

t2D

Lin

eRec

alcu

late

Ln

Loa

d2D

Plot

Loa

dPl

otL

ockC

utPl

aneN

orm

alL

ockC

utPl

aneO

rigi

nL

ockV

olum

eL

ogM

agM

ater

ial

Mat

hFun

cM

axim

umM

axPo

sM

inim

umM

inPo

sM

odel

Max

Mod

elM

inM

odif

yCut

Plan

eM

odif

yPlo

tM

odif

yPoi

ntN

egN

orm

alN

orm

alC

ompo

nent

Obj

ectL

istC

reat

eO

bjec

tLis

tMod

ify

Orp

hanP

lots

Phas

ePl

otPl

otM

esh

Plot

Mod

ifyF

unct

ion

Poin

tCre

ate

Poin

tMod

ify

Poin

tVal

uePl

otPo

pPo

wPu

shR

ead

Solu

tion

sR

eal

Rem

oveF

aceA

tPos

Rem

oveF

aceW

ithI

dR

emov

eObj

ectF

rom

Lis

tR

enam

eEnt

ryR

enam

eLin

eR

enam

ePlo

tR

enam

ePoi

ntR

enam

eSur

face

Ren

ameV

olum

eR

ollD

nR

ollU

pSa

ve2D

Plot

Save

Plot

Scal

arX

Scal

arY

Scal

arZ

SetA

rrow

SetC

olor

map

SetF

illed

SetG

rid

Spac

ing

SetH

idd

enL

ine

SetL

ine

SetM

arke

rSe

tMes

hExt

erna

lSe

tMes

hSca

leSe

tNum

Poin

tsSe

tPlo

tAtt

ribu

tes

SetR

efin

emen

tSe

tSca

leSe

tTex

tMar

ker

SetT

rans

pare

ncy

Show

Col

orK

eySm

ooth

Solu

tion

Nam

eSq

rtSt

oreC

ompu

tati

ons

Surf

aceP

lot

Tan

gent

Tan

gent

Com

pone

ntT

opU

ndo

Upd

ateP

lots

Val

ueV

ecX

Vec

YV

ecZ

Vol

umeB

oxC

reat

eV

olum

ePlo

tW

rite

Solu

tion

s

Page 274: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Script Commands

A-14

Mat

rix

Dat

a P

ost

Pro

cess

or

Scr

ipt

Co

mm

and

s(c

onti

nued

on

next

pag

e)

Gen

eric

Mod

ule

mod

3pro

jm

od3v

iew

Cas

cad

eAll

Cas

cad

ePro

ject

sC

asca

deV

iew

sC

lose

Win

dow

Mod

uleI

sPro

mpt

Vis

ible

Mod

uleP

refs

Rev

ert

Mod

uleS

aveP

refs

Mod

uleS

idew

inL

eft

Mod

uleS

idew

inR

ight

Mod

uleT

oggl

eMes

sage

Mod

uleT

oggl

ePro

mpt

Mod

uleT

oolb

ar(d

irec

tion

)M

odul

eToo

lbar

Hid

eN

ewW

ind

owPr

intE

ntir

ePr

intP

roj

Prin

tRec

tPr

intS

ubw

inPr

intV

iew

Tile

AllG

rid

Tile

AllH

rzT

ileA

llVrt

Tile

Proj

ects

Gri

dT

ilePr

ojec

tsH

rzT

ilePr

ojec

tsV

rtT

ileV

iew

sGri

dT

ileV

iew

sHrz

Tile

Vie

wsV

rt

Abo

rtT

imeo

utA

ctiv

ateV

iew

Che

ckO

verl

apD

elet

eCS

Des

elec

tD

ispS

had

edD

ispW

ire

Flus

hEve

nts

Get

Cur

Pos

Get

Dou

ble

“Pro

mpt

”G

etL

ong

“Pro

mpt

”G

etN

umO

bjec

tsG

etN

umV

Iew

sG

etO

bjec

tNam

eG

etO

rigi

nG

etPo

siti

on “

Prom

pt”

Get

Stri

ng “

Prom

pt”

Get

Uni

tCon

vG

etU

nitN

ame

Get

Vec

tor

“Pro

mpt

”G

loba

lCS

Hid

eH

ideO

rien

tH

ideR

egio

nH

ideS

elL

ist

Loc

alC

SL

orig

inO

bjec

tCS

Obj

ectE

xist

sO

rigi

n

Ori

gin?

Prin

tPro

jPr

intV

iew

Rec

olor

Res

tore

CS

Rot

ateC

SR

otat

edC

SSa

veC

md

Win

Save

CS

Save

Win

dow

Sele

ctSe

lInB

oxSe

tCur

Pos

SetO

bjec

tCS

Show

Show

All

Show

Ori

ent

Show

Reg

ion

Tog

gleR

egio

nU

nrot

ated

CS

Ver

ifyR

egio

nV

isB

yIte

mX

Axi

sAbo

utT

oX

Axi

sTo

XU

nitV

ec?

YA

xisA

bout

To

YA

xisT

oY

Uni

tVec

?Z

Axi

sAbo

utT

oZ

Axi

sTo

ZU

nitV

ec?

Aut

oGri

dFi

tAll

FitA

llVie

ws

FitS

elL

ooka

tO

rtho

Pers

pPo

larG

rid

Rec

tGri

dR

eset

Vie

ws

Rot

Vie

wSh

aded

Vie

wpo

int

Wir

efra

me

Page 275: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Data Post Processor Script Commands

A-15

Mat

rix

Dat

a P

ost

Pro

cess

or

Scr

ipt

Co

mm

and

s(c

onti

nued

)

Def

ault

HFS

SM

atri

x D

ata

Ad

dA

ssig

nC

lear

All

Cle

arFu

ncti

ons

Cle

arV

ars

Com

plex

Form

atC

ompo

nent

Com

pone

ntC

ount

Dat

abas

eAd

dR

owD

atab

aseG

etC

olum

nsD

atab

aseG

etFi

eld

Dat

abas

eGet

Row

sD

atab

aseS

etFi

eld

Del

eteD

atab

ase

Div

Dou

bleL

istS

etC

ompo

nent

Dum

pDat

abas

eE

cho

EQ

Err

orE

valu

ateE

xpre

ssio

nE

xpor

tDat

abas

eFi

leC

lose

File

Exe

cFi

leE

xecE

rrE

xitI

fFi

leE

xecP

ause

File

Exi

sts

File

Ope

nFi

leR

ead

File

Rec

ord

File

Rec

ord

App

end

File

Rec

Stop

File

Wri

teFu

ncD

efFu

ncH

elp

Func

Save

Func

Und

efG

EG

etD

ateA

ndT

ime

Get

File

Lis

tG

etFi

leN

ame

Get

Mac

roPa

thG

etM

acro

Path

Lis

tG

etPr

oduc

tId

Get

Use

rOpt

ion

Get

Ver

sion

Glo

bal

Glo

balA

ssig

nG

TH

elp

Impo

rtD

atab

ase

Impo

rtR

awD

atab

ase

IsC

omm

and

Ena

bled

LE

Log

10L

TM

inus

Mul

NE

New

Dat

abas

eO

RPa

ram

etri

cFile

Exe

cPo

s2Po

s3

Pos3

Dis

tPr

epen

dM

acro

Path

Prin

tHel

pPr

ivat

eAss

ign

Prot

ecte

dA

ssig

nR

and

omFr

acti

onR

emov

eMac

roPa

thSe

tEch

oEna

bled

SetM

acro

Path

Lis

tSe

tRec

ord

ingE

nabl

edSe

tUni

tsO

fQua

ntSe

tUse

rOpt

ion

Slee

pSt

rCon

cat

Stri

ngSt

ring

Lis

tSet

Com

pone

ntSt

rlen

Strs

trSu

bSu

bstr

ing

Una

ssig

nV

ec2

Vec

3X

OR

Em

issi

onsS

etup

Lau

nchB

ound

arie

sL

aunc

hIm

ped

Onl

yL

aunc

hMat

eria

lsL

aunc

hMod

eler

Post

Fiel

ds

Post

Mat

rixD

ata

Post

Mat

rixP

lot

Proj

Dir

Proj

Nam

eSe

lect

Solu

tion

Typ

eSo

lveN

omin

alSo

lveS

etup

Cre

ateS

pice

Exp

orte

rO

verr

ideS

pice

Exp

orte

rVal

ueSz

gDat

aKer

nelC

reat

eSw

eep

SzgD

ataK

erne

lCom

pute

Ter

min

alSz

gDat

aKer

nelC

ompu

teY

ZSz

gDat

aKer

nelD

eem

bed

SzgD

ataK

erne

lDel

ete

SzgD

ataK

erne

lExi

tSz

gDat

aKer

nelE

xpor

tSz

gDat

aKer

nelI

mpo

rtSz

gDat

aInt

erpo

late

Val

ueSz

gDat

aIsT

erm

inal

Soln

SzgD

ataK

erne

lRen

orm

aliz

eSz

gDat

aKer

nelR

enor

mT

erm

inal

SzgD

ataL

astS

olnO

fTyp

eSz

gDat

aMat

rixV

alue

SzgD

ataN

umPo

rtM

odes

SzgD

ataN

umPo

rts

SzgD

ataN

umSo

lnFr

eqs

SzgD

ataN

umSo

lns

SzgD

ataS

ave

SzgD

ataS

olnF

req

SzgD

ataS

olnN

ame

Page 276: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Script Commands

A-16

Mat

rix

Plo

t P

ost

Pro

cess

or

Scr

ipt

Co

mm

and

s(c

onti

nued

on

next

pag

e)

Gen

eric

Mod

ule

mod

3pro

jD

efau

ltM

atri

xPlo

t

Cas

cad

eAll

Cas

cad

ePro

ject

sC

asca

deV

iew

sC

lose

Win

dow

Mod

uleI

sPro

mpt

Vis

ible

Mod

uleP

refs

Rev

ert

Mod

uleS

aveP

refs

Mod

uleS

idew

inL

eft

Mod

uleS

idew

inR

ight

Mod

uleT

oggl

eMes

sage

Mod

uleT

oggl

ePro

mpt

Mod

uleT

oolb

ar(d

irec

tion

)M

odul

eToo

lbar

Hid

eN

ewW

ind

owPr

intE

ntir

ePr

intP

roj

Prin

tRec

tPr

intS

ubw

inPr

intV

iew

Tile

AllG

rid

Tile

AllH

rzT

ileA

llVrt

Tile

Proj

ects

Gri

dT

ilePr

ojec

tsH

rzT

ilePr

ojec

tsV

rtT

ileV

iew

sGri

dT

ileV

iew

sHrz

Tile

Vie

wsV

rt

Abo

rtT

imeo

utA

ctiv

ateV

iew

Che

ckO

verl

apD

elet

eCS

Des

elec

tD

ispS

had

edD

ispW

ire

Flus

hEve

nts

Get

Cur

Pos

Get

Dou

ble

“Pro

mpt

”G

etL

ong

“Pro

mpt

”G

etN

umO

bjec

tsG

etN

umV

iew

sG

etO

bjec

tNam

eG

etO

rigi

nG

etPo

siti

on “

Prom

pt”

Get

Stri

ng “

Prom

pt”

Get

Uni

tCon

vG

etU

nitN

ame

Get

Vec

tor

“Pro

mpt

”G

loba

lCS

Hid

eH

ideO

rien

tH

ideR

egio

nH

ideS

elL

ist

Loc

alC

SL

orig

inO

bjec

tCS

Obj

ectE

xist

sO

rigi

n

Ori

gin?

Prin

tPro

jPr

intV

iew

Rec

olor

Res

tore

CS

Rot

ateC

SR

otat

edC

SSa

veC

md

Win

Save

CS

Save

Win

dow

Sele

ctSe

lInB

oxSe

tCur

Pos

SetO

bjec

tCS

Show

Show

All

Show

Ori

ent

Show

Reg

ion

Tog

gleR

egio

nU

nrot

ated

CS

Ver

ifyR

egio

nV

isB

yIte

mX

Axi

sAbo

utT

oX

Axi

sTo

XU

nitV

ec?

YA

xisA

bout

To

YA

xisT

oY

Uni

tVec

?Z

Axi

sAbo

utT

oZ

Axi

sTo

ZU

nitV

ec?

Ass

ign

Cle

arA

llC

lear

Func

tion

sC

lear

Var

sC

ompo

nent

Dat

abas

eAd

dR

owD

atab

aseG

etC

olum

nsD

atab

aseG

etFi

eld

Dat

abas

eGet

Row

sD

atab

aseS

etFi

eld

Del

eteD

atab

ase

Ech

oE

rror

Exp

ortD

atab

ase

File

Exe

cFi

leR

ecor

dFi

leR

ecor

dA

ppen

dFi

leR

ecSt

opFu

ncD

efFu

ncH

elp

Func

Save

Func

Und

efH

elp

Impo

rtD

atab

ase

Impo

rtR

awD

atab

ase

New

Dat

abas

ePo

s2Po

s3Po

s3D

ist

Prin

tHel

pSe

tUni

tsO

fQua

ntSl

eep

StrC

onca

tSt

ring

Una

ssig

nV

ec2

Vec

3

SzgP

lotA

ccep

tCal

cEd

itSz

gPlo

tAcc

eptS

igE

dit

SzgP

lotA

dd

Gra

phSz

gPlo

tCan

celC

alcE

dit

SzgP

lotC

ance

lSig

Ed

itSz

gPlo

tCre

ate

SzgP

lotI

mpo

rtSz

gPlo

tKer

nelA

dd

Exp

rSz

gPlo

tKer

nelD

elE

xpr

SzgP

lotK

erne

lEd

itFf

tSz

gPlo

tKer

nelE

dit

SigP

ulse

SzgP

lotK

erne

lEd

itSi

gXY

SzgP

lotK

erne

lExi

tSz

gPlo

tKer

nelF

itA

llSz

gPlo

tKer

nelM

axim

ize

SzgP

lotK

erne

lSav

eSz

gPlo

tKer

nelS

aveC

alc

SzgP

lotK

erne

lSav

eSig

SzgP

lotK

erne

lSet

SigN

ame

SzgP

lotK

erne

lZoo

mSz

gPlo

tSet

upC

alcE

dit

SzgP

lotS

etup

SigE

dit

Page 277: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Script Commands

A-17

Mat

rix

Plo

t P

ost

Pro

cess

or

Scr

ipt

Co

mm

and

s(c

onti

nued

)

Def

ault

mod

3vie

wM

atri

xPlo

t

Ad

dA

ssig

nC

lear

All

Cle

arFu

ncti

ons

Cle

arV

ars

Com

plex

Form

atC

ompo

nent

Com

pone

ntC

ount

Dat

abas

eAd

dR

owD

atab

aseG

etC

olum

nsD

atab

aseG

etFi

eld

Dat

abas

eGet

Row

sD

atab

aseS

etFi

eld

Del

eteD

atab

ase

Div

Dou

bleL

istS

etC

ompo

nent

Dum

pDat

abas

eE

cho

EQ

Err

orE

valu

ateE

xpre

ssio

nE

xpor

tDat

abas

eFi

leC

lose

File

Exe

cFi

leE

xecE

rrE

xitI

fFi

leE

xecP

ause

File

Exi

sts

File

Ope

nFi

leR

ead

File

Rec

ord

File

Rec

ord

App

end

File

Rec

Stop

File

Wri

teFu

ncD

efFu

ncH

elp

Func

Save

Func

Und

efG

EG

etD

ateA

ndT

ime

Get

File

Lis

tG

etFi

leN

ame

Get

Mac

roPa

thG

etM

acro

Path

Lis

tG

etPr

oduc

tId

Get

Use

rOpt

ion

Get

Ver

sion

Glo

bal

Glo

balA

ssig

nG

TH

elp

Impo

rtD

atab

ase

Impo

rtR

awD

atab

ase

IsC

omm

and

Ena

bled

LE

Log

10L

TM

inus

Mul

NE

New

Dat

abas

eO

RPa

ram

etri

cFile

Exe

cPo

s2Po

s3

Pos3

Dis

tPr

epen

dM

acro

Path

Prin

tHel

pPr

ivat

eAss

ign

Prot

ecte

dA

ssig

nR

and

omFr

acti

onR

emov

eMac

roPa

thSe

tEch

oEna

bled

SetM

acro

Path

Lis

tSe

tRec

ord

ingE

nabl

edSe

tUni

tsO

fQua

ntSe

tUse

rOpt

ion

Slee

pSt

rCon

cat

Stri

ngSt

ring

Lis

tSet

Com

pone

ntSt

rlen

Strs

trSu

bSu

bstr

ing

Una

ssig

nV

ec2

Vec

3X

OR

Aut

oGri

dFi

tAll

FitA

llVie

ws

FitS

elL

ooka

tO

rtho

Pers

pPo

larG

rid

Rec

tGri

dR

eset

Vie

ws

Rot

Vie

wSh

aded

Vie

wpo

int

Wir

efra

me

SzgP

lotA

ccep

tCal

cEd

itSz

gPlo

tAcc

eptS

igE

dit

SzgP

lotA

dd

Gra

phSz

gPlo

tCan

celC

alcE

dit

SzgP

lotC

ance

lSig

Ed

itSz

gPlo

tCre

ate

SzgP

lotI

mpo

rtSz

gPlo

tKer

nelA

dd

Exp

rSz

gPlo

tKer

nelD

elE

xpr

SzgP

lotK

erne

lEd

itFf

tSz

gPlo

tKer

nelE

dit

SigP

ulse

SzgP

lotK

erne

lEd

itSi

gXY

SzgP

lotK

erne

lExi

tSz

gPlo

tKer

nelF

itA

llSz

gPlo

tKer

nelM

axim

ize

SzgP

lotK

erne

lSav

eSz

gPlo

tKer

nelS

aveC

alc

SzgP

lotK

erne

lSav

eSig

SzgP

lotK

erne

lSet

SigN

ame

SzgP

lotK

erne

lZoo

mSz

gPlo

tSet

upC

alcE

dit

SzgP

lotS

etup

SigE

dit

Page 278: NSOFT · PDF fileNSOFT Ansoft High Frequency Structure Simulator Introduction to the Ansoft Macro Language ... Ansoft HFSS starts and immediately executes the macro. Once the

Matrix Plot Post Processor Script Commands

A-18