Professional Documents
Culture Documents
A Pi Reference
A Pi Reference
ni.com/awr
API Scripting Guide
NI AWR Design Environment v13 Edition
LEGAL NOTICES
Trademarks
Analog Office, APLAC, AWR, AWR Design Environment, AXIEM, Microwave Office, National Instruments, NI, ni.com and TX-Line
are registered trademarks of National Instruments. Refer to the Trademarks section at ni.com/trademarks for other National Instruments
trademarks.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.
Patents
The information in this guide is believed to be accurate. However, no responsibility or liability is assumed by National Instruments for its
use.
Table of Contents
NI AWR Scripting Guide ..................................................................................................................... 11
Introduction .............................................................................................................................. 11
The Script Development Environment ............................................................................................ 13
Developing a Script ................................................................................................................... 113
Working with Schematics ........................................................................................................... 172
Working with Netlists ............................................................................................................... 1134
Working with EM Structures ...................................................................................................... 1135
Working with Graphs ............................................................................................................... 1192
Optimizing, Tuning, and Yield ................................................................................................... 1238
DataSets ................................................................................................................................ 1253
Layout ................................................................................................................................... 1267
Variables and Equations ............................................................................................................ 1545
Sweeper Object ....................................................................................................................... 1566
Working with System Diagrams ................................................................................................. 1569
Libraries Collection of Objects ................................................................................................... 1584
SwitchLists Collection of Objects ............................................................................................... 1588
Scripting the NI AWR SDE Externally ........................................................................................ 1589
Working with the Windows Collection of Objects .......................................................................... 1594
Working with the Job Scheduler queues Collection of Objects .......................................................... 1595
Working with Folders and Files Collection of Objects ..................................................................... 1597
Working with Design Notes Collection of Objects .......................................................................... 1608
Working with Wizards via the API .............................................................................................. 1611
AWR Design Environment Component API ............................................................................................. 21
Introduction ............................................................................................................................... 21
Objects List ............................................................................................................................... 21
Enumerations List ..................................................................................................................... 212
Count ...................................................................................................................................... 218
Add ........................................................................................................................................ 223
Remove ................................................................................................................................... 228
Clear ....................................................................................................................................... 231
Name ...................................................................................................................................... 232
Value ...................................................................................................................................... 235
Activate .................................................................................................................................. 235
NewWindow ............................................................................................................................ 236
Print ....................................................................................................................................... 236
Caption ................................................................................................................................... 237
Delete ..................................................................................................................................... 237
Exists ...................................................................................................................................... 238
Copy ...................................................................................................................................... 242
Ccopy ..................................................................................................................................... 242
Update .................................................................................................................................... 243
Import ..................................................................................................................................... 243
LinkTo .................................................................................................................................... 244
Coptions .................................................................................................................................. 244
Application .............................................................................................................................. 245
Project .................................................................................................................................... 252
ProjectFile ............................................................................................................................... 271
ProjectFiles .............................................................................................................................. 271
ControlBar ............................................................................................................................... 271
You can create scripts for the NI AWRDE using the VBA script language, Visual Basic, C++, Java Script, Perl and other
languages.
This document contains many working scripts with problems and solutions and explains the basic concepts of NI AWRDE
scripting while providing you with coding examples. It also provides information on the most useful objects, properties,
and methods for creating scripts in the NI AWR Script Development Environment (NI AWR SDE). Selected objects and
properties are supplied with detailed explanations and examples to demonstrate various approaches to problem solving.
Introduction
The NI AWR Design Environment (NI AWRDE) exposes a Component Object Model (COM) Automation Application
Programming Interface (API). The API provides unlimited ways to extend the capabilities of the software from
programming languages such as Visual Basic (including VBScript and VBA), Java Script, Visual C++, and the Windows
Scripting Host. Using the NI AWRDE object model you can create scripts and author wizards for automating common
or complex tasks.
The NI AWRDE has a built-in Visual Basic-compatible Script Development Environment (SDE) accessible by choosing
Tools > Scripting Editor. Within the SDE you can write macros or small programs. The SDE is described further in The
Script Development Environment.
The NI AWRDE also allows authored code to be tightly integrated into its framework with Wizard components. With
a Wizard component, your code is compiled into a DLL and is loaded by the program when it starts. Wizards are run
from within the program and can save data inside the Project file. The Wizards feature is described further in Wizards.
Applications (like NI AWR's) that are implemented as COM Automation Servers share a common API that allows them
to be easily integrated with any other COM Automation Servers via a single COM Automation Client such as a Visual
Basic script. This COM Automation Client has control over all of the COM Automation Servers installed on the machine.
Each COM Automation Server runs in its own process space, while the COM automation mechanism takes care of
transferring information across processes. Any data extracted from the object model of one application object can be
used within the object model of any other application object.
The following figure shows how a single COM Automation Client is used to control a number of other applications
including the NI AWRDE. This COM Automation Client can be the NI AWRDE built-in scripting engine, or it can be
an external automation client. The built-in scripting engine allows you to execute scripts from within the program
environment.
In the traditional approach to adding a scripting engine to an application, the scripting engine runs within and is tightly
embedded in the application, as shown in the following figure. The API can only be used to control a single Instance of
the application itself. While useful for automating tasks within the application, it does not allow the application to be
integrated with other applications using a common scripting language.
A Non-Proprietary Solution
Scripting languages are typically proprietary languages that are unique to the application, requiring users to learn
specialized syntax that may not be well-documented. With the COM automation approach, you have a choice of languages
such as Visual Basic and C++ that are standard, well-supported, and well-documented.
An Object-Oriented Solution
The COM automation approach is designed for use with object-oriented applications. A COM Automation Server exposes
the underlying object model of the application as objects within the scripting or programming environment, and allows
you to use powerful object-oriented software techniques in the scripts or programs that control these applications. An
object-oriented API allows direct manipulation of the underlying objects via an unlimited set of operations.
In contrast, flat functional APIs require that all operations performed on the underlying software application be performed
through a set of functions that manipulate the underlying objects in the application. The limited set of functions in the
flat API restricts the operations that can be performed on the underlying object model.
Create scripts to automate tasks within the program, and then optionally assign the scripts to function keys.
Author design wizards that add functionality to the program, such as a synthesis capability.
Customize the program to address your own design problems.
Integrate third-party tools1 with the program to perform types of analysis not offered by the NI AWRDE, such as
thermal analysis on physical layout.
Use the program as a design framework that ties together different COM-compliant applications which can leverage
the tools that are built into the framework. For example, the NI AWRDE can be one of several COM-compliant
applications integrated to create a completely automated manufacturing or testing system.
Create a Bill of Materials or other type of documentation that can be generated from the program's design database.
The Scripting Editor contains BASIC script modules that you can run from the program by choosing Scripts > Global
Scripts or Scripts > Project Scripts directly, or from within the SDE. The script modules are designated as either Global
or Project scripts.
NOTE: Do not manually edit (add, remove, or change) the scripting files included in the NI AWRDE installation.
Changes to these files are permissible only through the NI AWR SDE.
1
Future enhancements to the COM Automation API will allow the integration of third-party simulation tools.
If the Scripting Editor button does not display, right-click the Wizards node in the Project Browser and choose Manage
Wizards to display the Addin Manager dialog box. Ensure that the AWR Scripting IDE check box is selected and that
ScriptingIDE.dll is in your \Wizards subdirectory. The major components of the SDE are described in the following
table:
Name Description
Project Script Project Browser (or simply, Project Browser). Allows you to create scripts
to automate tasks within the NI AWRDE. The scripts display as two subnodes.
The first subnode, Global, contains global modules. The second subnode,
Projectname.emp, contains project-specific modules.
Menus A set of menus displays only if the SDE is active: File, Edit, View, Insert, Debug,
Run and Help.
Most of the menu choices and commands are also available as buttons on the
toolbar.
Script workspace The area in which you design, run, and debug scripts.
Immediate window The area in which you can print the results of a running script and watch the
value of the variables during the debugging process.
Toolbars (Debug and Edit) A row of buttons that provides shortcuts for editing, running, and debugging
scripts; creating new Code Modules; accessing VBA Object Browser Help;
adding available references to a Project; and for accessing Immediate, Watch
and Quick Watch Windows.
To view a tool tip for a particular toolbar command, pass the cursor over the
button.
DCVal DC Value (Used for DC analysis)
Project scripts are saved in the Project, so if you copy your Project file to another machine, your scripts are automatically
included. The Projectname.emp subnode contains project-specific modules with the Project root name. These subnodes
can also contain folders for Object and Code modules. Project scripts are included in a Project by creating a new script
or importing an existing script.
Global scripts are available to all Projects. The Global subnode contains global scripts that are stored separately in
individual *.bas files located in specific folders on your computer. Scripts shipped with the program installer are located
at $AWR/Scripts. You should save to the appdatauser/Scripts folder any Global scripts that you add. To locate this folder,
choose Help > Show Files/Directories to open the Directories dialog box, then double-click the ScriptsUser folder. You
can add a new *.bas file to your appdatauser/Scripts folder, then right-click the Global node and choose Check For New
Files to make the new script available.
To define more than one global script folder, add the following line in your User.ini file:
[File Locations]
Scripts=$DEFAULT;<path>
where <path> is the full or relative path to the folder to search for additional *.bas files. You can add more than one
path by separating paths with semi-colons. PDKs can also specify a Scripts file location, so scripts can be shipped with
PDKs and loaded automatically as global scripts.
You can also store a script as a .bas file individually by right-clicking the script in the Project Browser and choosing
Export scriptname. You can import a script to any Project by right-clicking the script in the Project Browser and choosing
Import.
Both nodes each contain sets of folders grouping the different module types together. The NI AWRDE SDE supports
two types of modules: Object Modules and regular Code Modules.
The language used in scripts is SAX Basic, a subset of Microsoft Visual Basic for Applications. SAX Basic language
online Help is available by pressing F1.
Importing Scripts
In the SDE, you can Import scripts by right mouse click on the Object Modules and choose Import from the Right Click
Menu. This command open Import dialog. You need to find the directory where the script is and double - mouse click
on the *.bas file, like in the following picture:
After that the Module script will be opened in the SDE. Keep in mind that if you want to Import the Global script you
should right - mouse click on the Object Modules under the Global section of the SDE tree. If you want script to be saved
in the project you need to save the project after importing the script.
Running Scripts
In the SDE, you can run scripts by:
You can also run scripts directly from the main program menu by choosing Scripts. Scripts display either under Scripts
> Project Scripts or Scripts > Global Scripts, depending on the script location. The list that displays is in the format <module
name>(<sub name>). Any Sub in a given module that takes no input arguments is available in this list. You can hide any
such sub by using the "Private" declaration before the name of the sub function. For example, the following figure shows
a macro named "example" that has three sub functions, a,b, and c.
Notice that the third sub is declared private. If you choose Scripts > Project Scripts you can access only the first two sub
functions as shown in the following figure.
You can control how scripts display in the Scripts menu. Above any Sub you can add a line that defines the folder in
which to display the script. This line is in the form '$MENU=name where name is the desired folder name. The name
of the sub displays under that folder. You can use the folder name "hidden" to prevent that sub from displaying. For
example, you can add the line "' $MENU=Data" to display this script under the Data sub menu. Only one level of folders
is allowed. When you use this syntax the script is only in this folder; it is no longer in the Scripts > Project Scripts or
Scripts > Global Scripts folders. Because of this structure, NI AWR recommends that you write your scripts with one Sub
Main that uses the hidden folder tag, and then give your code a meaningful name that you then call from the Sub Main.
This is because you need a Sub Main to run the script from the SDE, but you want a meaningful name when running the
script from the Scripts menu. The following example scripting code demonstrates these various concepts.
' $MENU=hidden
sub main
Delete_Unassociated_iNets
end sub
' $MENU=Layout
Sub Delete_Unassociated_iNets
End sub
The following figure shows how this script displays in the NI AWRDE menu.
Notice that there is a folder named Layout and a script named "Delete_Unassociated_iNets" under that folder.
You can use menu, toolbar, or hotkey customizations to run any macro. See Customizing Toolbars and Menus and
Customizing Hotkeys for details on customizing these objects. When customizing, look for the Categories setting equal
to Macros.
Code Modules
Code modules contain procedures that run from start to finish when executed. This is useful for creating macros or
procedures for automating tasks that you would normally perform manually.
When you run a code module, a special procedure, Sub Main, is executed. This procedure can in turn call other procedures
with the module.
To create a module, right-click the Global or Projectname.emp node and choose Insert Module where <Projectname> is the
name of your current Project. A new module is added to the node. To edit the module code, right-click the module and
choose View Code to display the module in the Code Editor.
When you are ready to run the code, click the Run button on the toolbar. The Sub Main in your module begins executing.
To debug your code, choose View > Toolbars > Debug to display the Debug toolbox. Use the appropriate "step" buttons
on the Debug toolbar.
Object Modules
An Object module runs code in response to events generated by the NI AWRDE object. Object modules do not have a
Sub Main that executes when they run. Instead, they contain special functions called Event Handlers that execute in
response to events that objects start. When run, the Basic engine waits for an event to occur, such as adding a Schematic
to the Project. When the event occurs, the associated Event Handler code executes.
The NI AWRDE automatically adds an Object module to the Object Modules node for each available object that starts
events. The ThisProject subnode represents the currently open Project and displays when the Project is open. You can
add or remove other modules from the Object Modules node as you create and remove items from the Project.
To enter code that responds to an event, right-click the object module that starts the event and choose View Code to open
the module in the Code Editor. In the Code Editor window, select the object that starts the event from the Object list, and
then select an event from the Proc list. After you select an event, a handler procedure is added to the module and you
can add any additional code you want to execute. The following figures show this process.
Before the code can respond to events you must run the module by clicking the Run button on the toolbar. When you
open a Project, the Object modules are automatically set to Run mode. You cannot edit modules while they are running;
to make changes to the event procedures you must click the Reset button on the toolbar. When you are done editing,
click the Run button to start the module. Your event code is not executed while the module is stopped.
Next time you open the project with the macro running the dialog box should appear from the beginning asking if you
would like to Enable or Disable macros. If you set option "Always use the settings and do not warn again" the dialog
will never pops up again. So, if you will need to change the settings and to have the dialog back there should be an entry
in the user.ini file. Search for the project name in the user.ini and remove the entry for warning about the script. The
setting also may be in the mwoffice.ini file:
[test_project.emp]
EnableMacros=-1
The properties and methods of the object associated with the Object module are available as global keywords. You can
also access these properties and methods using the Me operator or the object name. For example, when editing code in
the ThisProject module the properties and methods of the Project object are exposed as global keywords. Because an
object module is associated with a specific Instance of an object, accessing a property gets the object's current value.
The following code fragments show the different syntax styles that you can use to save the Project when you add a new
Schematic.
Handle the NewSchematic event
Private Sub Project_NewSchematic(Schematic
As Schematic)
Use the Object name to call the Save method
ThisProject.Save
End Sub
To rename a script, right-click the Module# subnode and choose Rename Module#.
To delete a script, right-click the Module# subnode and choose Remove Module#.
Save your Project and the script is saved inside the Project *.emp file.
To import a script into an NI AWRDE Project, right-click the Projectname.emp node, choose Import and select the file
from the Import dialog box. The imported script name displays in the Project Browser.
To export a script, right-click the Module# subnode and choose Export Module#. Module# is saved as a *.bas file.
Creating References
To work with different automation clients and their objects, you should create a reference to a COM components type
library using the following steps in the SDE:
After loading a type library, you can use the objects, properties, and methods in your VBA code.
Getting Help
When typing code, press the F1 key to display Help for the specific word the cursor is over. If the cursor is over a
component that belongs to the NI AWR API, the NI AWRDE Help opens to the appropriate section, otherwise the Sax
Basic Help opens. See the AWR Design Environment Component API for the component specific Help section.
You can use the VBA Object Browser to view a list of the component's classes, properties, methods, and events.
To open the Object Browser in the SDE, click the Object Browser button on the toolbar or choose View > Object Browser.
The following figure shows the Object Browser with the NI AWRDE (MWOffice) type library selected.
An object-oriented API exposes all NI AWR SDE Elements as objects. When the Object Browser opens, it displays in
Library a list of all NI AWR SDE classes included in the current VBA Project. You can select a single component -
MWOffice, or All Libraries (SAX Basic). The Object Browser exposes all of the object classes available from the Automation
component. Select a class to display its methods and properties in Methods/Properties. You can see for example, what
data types are returned by various methods and properties, or what parameters a particular method expects. The collections
are also included in that list.
Debugging Scripts
You can see the results of a running script in the Immediate window if you insert into your script a "Debug.Print" method
for printing variable values, or you can use the Immediate window to watch the variable values when debugging the
script.
To watch the value of the variable during the debugging process, place the cursor on the variable you want to watch,
right-click and choose Quick Watch. You can watch the highlighted value of the variable during the debugging process
if you insert a breakpoint, run the script, and place the cursor over the variable when the script stops.
With the cursor on the operator you want to stop, right-click and choose Toggle Break.
Click the Code Module window on the left side of the operator you need to stop.
Press F9.
Choose Debug > Toggle BreakPoint.
To explore each command execution step-by-step, or just after cycle execution, use the following Debug menu commands:
Step Into F8
Step Over Shift + F8
Run To Cursor Ctrl + F8
Clear All Breakpoints Ctrl + Shift + F9
Toggle Breakpoint F9
Printing Scripts
To print a script, do one of the following:
Developing a Script
Using a Code Module at Startup
The preferred method for starting NI AWRDE scripts is to use a Sub Main procedure. To create a Sub Main procedure,
you must insert a Code Module into your Project. A new Code Module contains Sub Main and End Sub lines. You can
enter VBA code in the new module and reference any Objects and Forms that you need.
You can write Functions and Sub procedures in your code and use them as usual. Note that the program terminates when
the Sub Main procedure is completed.
You can use any of the varieties of data types that the VBA language offers, even a Variant data type.
Be careful when using a Variant data type if you are not sure that every item of variant data has a subtype that corresponds
to one of the major data types.
VBA allows the implicit declaration of variables. However, it is good programming practice to explicitly declare any
variables and constants you want to use by using the Dim, Private, or Public statements with the following syntax:
'Code Module
Sub Main
Dim a As Boolean, b As Byte, c As Complex
Dim d As Decimal, e As Double, i As Integer
Dim l As Long, s As String
Dim o As Object
Dim f As Single
Dim v As Variant
Private k As Integer
Public st As String
End Sub
VBA handles a lot of data type conversion in the background; you don't need to do it explicitly.
If you know how many values you need to store in an array, you can declare it with a Dim statement as follows:
This Dim statement creates an array named "vals" with six Elements, because all VBA arrays start with location 0.
For i = 0 To 5
vals (i) = i*1e8
Next i
If you try to access the Element at a location greater than 5, you receive an "Array out of range" error message.
If you do not know in advance how many Elements you need, declare a dynamic array using the following code:
When you determine the size of a dynamic array further in your code, you can specify the number of Elements using a
ReDim statement as follows:
There is no limit to the number of times you can re-dimension a dynamic array. To keep the data, use a Preserve keyword
to avoid losing data during re-dimensions.
ReDim creates a new array. The Preserve keyword copies the data from the old array to the new array. Note that you
always lose the data if you resize your array by contracting it.
For a more detailed explanation, see your VB and VBA fundamentals documentation.
To make scripts easier to develop, the properties and methods of the global MWOffice application object are added to
the Global namespace in the SDE. The API is designed as a rooted hierarchy with all objects accessible from one global
MWOffice Application object. Because you are working in the context of the MWOffice application when in the SDE,
making these accessible from the global namespace makes it simpler to access objects associated with the application.
It also makes it easier to use the Immediate window in the SDE to evaluate expressions. For example, to get a count of
the models currently loaded into the system you can type:
Models.Count
rather than
MWOffice.Models.Count
Both lines work, the first is just shorter. Likewise, you'll often use the MWOffice.Project object to access information
in the currently loaded Project. Again, you can directly access this object from the global namespace. With a Schematic
called "MySchematic", you could get a count of the Schematic Elements using:
Project.Schematics("MySchematic").Elements.Count
MWOffice.Project.Schematics("MySchematic").Elements.Count
and obtained the same result. You might want to use the "MWOffice." portion in the case of a namespace conflict. NI
AWR tries to avoid these conflicts, however occasionally a method or property name may match with either a global
from the SDE or another library reference in your Project. In these cases you can clarify which property or method you
intend by using the application portion "MWOffice." before the property or method name.
Option Explicit
You can use an Option Explicit statement to reduce the number of bugs in your code caused by other than spelling errors.
For example, when you work with the SDE you are able to access the properties and methods directly without qualifying
them with a "MWOffice." prefix. This works unless you have a collision with reserved basic VBA words. The following
are two examples.
Example 1:
The first statement should refer to the MWOffice.Left property, however, a syntax error displays because an MWOffice
reference is omitted and the corresponding VBA Left() function should include parentheses.
If you are not sure about possible collisions, always use the explicit prefix of the reference library:
Example 2:
In the following statement, the value is not what was expected because we just created a new variable named Count that
has no type and no value. Remember that you do not need to declare variables before they are used in VBA; the program
automatically creates new variables as they are used.
Use an "Option Explicit" declaration at the top of the file to avoid this problem:
'Code Module
Option Explicit
Sub Main
Dim a As Boolean
End Sub
If you want to reference sub routines or functions in other .bas files, there are several options. This can be a good way
to track common groups of code you want to reuse and easily update. The disadvantage to these approaches is that you
cannot debug into any referenced functions.
To reference subs and functions in a stand-alone file, use the following in your script:
'#Uses "global.bas"
Sub main
End Sub
The path to the file can be an absolute path or a path relative to the NI AWR Project file in which you are working.
Alternatively, you can reference subs and functions in another script loaded in the SDE for that type (Global or Project)
by using the following in your script:
'#Uses "*global"
Sub main
End Sub
Notice a few differences. There is no path to the file. You use a "*" before the name. You do not use the .bas extension
for the file.
NOTE: You cannot reference items in a Project level script in Global scripts, nor items in a Global level script in Project
scripts.
Object classes are the type of objects that an Automation server makes available for you to control. Object classes have
a defined set of properties, methods, and events that dictate how Instances of that object class look and act. When you
write Automation code, you manipulate objects that are Instances of object classes. Objects are created at run-time and
are then destroyed when no longer needed, or when the application ends.
The NI AWRDE provides a Component Object Model (COM) library that contains many objects and allows a number
of methods to perform operations with them. If you want access to a different type library and all objects in that library,
you need to set a reference to the library by choosing Edit > References and selecting an available reference.
The program follows the convention of using plural names to denote collections.
To use the object's library you must declare an object variable, which creates an Instance of the object as follows:
Dim le As MWOffice.LibraryElement
Dim s As Schematic
Dim em As EMStructure
Dim l As Layout
Dim c As Cell
Dim ap As Application
Dim ax As Axis
Dim cl As CellLibrary
Dim w As Window
Dim v As Vertex
Dim myObject As Object
In this example, "Schematics" denotes a collection of Schematic objects, and "EMStructures" denotes a collection of
EMStructure objects.
If you use a different type library, for example Excel, you need to explicitly address that library:
NOTE: Don't forget to make a reference to Excel before using this declaration.
After you declare an object variable, you must assign an object reference to a real Instance of the class before you can
use the object's methods, properties, and events. To assign an object reference to a real Instance of the class, use the Set
statement. For example, to produce an early bound reference to the object:
Set s = Project.Schematics.Add("Filter")
Set em = Project.EMStructures.Add("EM Lange")
If you declare a generic Object you must use either CreateObject or GetObject functions to produce a late bound reference
to the object.
As previously stated, VBA features one generic object type, the Collection object. Typically its members are other objects
and other collection of objects. Generally, you can use the following methods to work with a Collection:
Note that a Collection is similar to an array, except that the lower bound of a Collection object's index is always 1.
In addition, most Collections use the Item method as default, so the following expressions are really equivalent:
MWOffice.Windows(2).Close
MWOffice.Windows.Item(2).Close
You can iterate the members of Collections using the "For Each ... Next" statement as follows:
'Code Module
Sub Main
Dim eqn As Equation
For Each eqn In Project.GlobalEquations
Debug.Print eqn.Expression
Next eqn
End Sub
You can iterate through a collection by obtaining its Count property value, which returns the number of items in the
Collection, and by executing a "For ... Next" loop as follows:
'Code Module
Sub Main
Dim eqn As Equation
For i = 1 to Project.GlobalEquations.Count
Debug.Print eqn.Expression
Next i
End Sub
You can remove a member from the Collection by its index or special name. Note that after you remove a member the
number of members decreases, so the next loop does not work.
'Code Module
Sub Main
Dim eqn As Equation
For i = 1 to Project.GlobalEquations.Count
Project.GlobalEquations.Remove.(i)
Next i
End Sub
'Code Module
Sub Main
Dim eqn As Equation
For i = 1 to Project.GlobalEquations.Count
Project.GlobalEquations.Remove.(1)
Next i
End Sub
For an overview of the NI AWRDE SDE collections and objects, see the "AWR Design Environment Component API".
Event Handler
Scripts are packaged in two forms, Code Modules, in which you enter procedural code, and Object Modules, in which
you enter event handlers. Object Modules do not have a "Sub Main" that executes when you click the Run button on the
toolbar. Instead, the Object Module contains special functions, called event handlers, which execute in response to events
that are fired by an object. When you click the Run button on the toolbar, the basic engine waits for an event to occur,
such as adding a Schematic to a Project. When the event occurs, the event handler code for the event executes.
To add an event handler, double-click the ThisProject node under the Project level Object Modules node. In the Script
Editor window, choose Project as the Object. In Proc, choose the event you wish to handle. The event handler function
declaration is inserted into the Code Editor. You can now add your code to customize the handler. Event handlers must
be running in order to respond to events. Project event handlers are automatically started when the Project opens.
To edit event handler code, you must stop execution. "ThisProject" represents the currently open Project and exists as
long as the Project is open. You can add or remove modules from the Object Modules node.
AfterSave
AfterSimulate
AfterSystemSimulate
BeforeClose
BeforeSave
BeforeSimulate
BeforeSystemSimulate
CellLibraryAfterRemove
CellLibraryAfterRename
CellLibraryBeforeRemove
CellLibraryBeforeRename
DataFileAfterRemove
DataFileAfterRename
DataFileBeforeRemove
DataFileBeforeRename
EMStructureAfterRemove
EMStructureAfterRename
EMStructureBeforeRemove
EMStructureBeforeRename
GraphAfterRemove
GraphAfterRename
GraphBeforeRemove
GraphBeforeRename
GraphNewMeasurement
NetlistAfterRemove
NetlistAfterRename
NetlistBeforeRemove
NetlistBeforeRename
New
NewCellLibrary
NewDataFile
NewSchematic
NewEMStructure
NewGraph
NewNetlist
NewOptGoal
NewOutputFile
NewProcessDefinition
NewSchematis
NewSystemDiagram
NewYieldGoal
Open
OptGoalAfterChange
OptGoalAfterRemove
OptGoalAfterToggleEnable
OptGoalBeforeChange
OptGoalBeforeRemove
OptGoalBeforeToggleEnable
OptimizerIteration
OptimizerStarted
OptimizerStopped
OutputFileAfterRemove
OutputFileAfterRename
OutputFileBeforeRemove
OutputFileBeforeRename
ProcessDefinitionAfterChange
ProcessDefinitionAfterRemove
ProcessDefinitionBeforeChange
ProcessDefinitionBeforeRemove
SchematicAfterRemove
SchematicAfterRename
SchematicBeforeRemove
SchematicBeforeRename
SchematicNewElement
SystemDiagramAfterRemove
SystemDiagramAfterRename
SystemDiagramBeforeRemove
SystemDiagramBeforeRename
SystemDiagramNewElement
YieldAnalysisIteration
YieldAnalysisStarted
YieldAnalysisStoppeed
YieldGoalChange
YieldGoalAfterRemove
YieldGoalAfterChange
YieldGoalAfterToggleEnable
YieldGoalBeforeRemove
YieldGoalBeforeChange
YieldGoalBeforeToggleEnable
'Project Module
Private Sub Project_AfterSave()
MsgBox "After save"
End Sub
The following example script shows how to use events for calculating simulation time:
End Sub
Private Sub Project_SchematicAfterRename(Schematic As Schematic, ByVal OldName As String)
MsgBox "SchematicAfterRename"
End Sub
Private Sub Project_SchematicBeforeRemove(Schematic As Schematic, Cancel As Boolean)
MsgBox "SchematicBeforeRemove"
End Sub
Private Sub Project_SchematicBeforeRename(Schematic As Schematic, ByVal NewName As String, Cancel A
MsgBox "SchematicBeforeRename"
End Sub
Private Sub Project_SchematicNewElement(Schematic As Schematic, Element As Element)
MsgBox "SchematicNewElement"
End Sub
As previously explained, before event handling, modules must be grouped in a ThisProject node. You may now add your
code to customize the handler. Event handlers must be running in order to respond to events. Project event handlers are
automatically started when the Project opens. To edit event handler code you must stop execution.
If you save this code under the Projectname.emp node, the event functions only in the current Project. If you save this
code under the Global node, the script functions in all Projects.
While working with the event handler, if you choose an event and write some code, ensure that the code is correct. For
example, if the event is in Project Open and the event imports a file to the program and the name of the file is incorrect,
upon opening the Project, your OnProjectOpen handler calls Import, which returns an error. Click OK to respond to the
error. The application appears hung, but is actually at a breakpoint in your script which is being called by MWOffice.
To continue, open the ThisProject module and press F8 to resume the script. MWOffice will continue to run normally.
NOTE: NI AWR includes project_New event to compliment the project_Open event handler. You can use this event
when loading new Projects.
The properties and methods of the object associated with the Object Module are available as global keywords. You can
access these properties and methods using the Me operator or the object name. For example, when editing code in the
ThisProject module, the properties and methods of the Project object are exposed as global keywords. Because an Object
Module is associated with a specific Instance of an object, accessing a property gets the object's current value.
The following code fragments show the different syntax styles you can use to save the Project when you add a new
Schematic.
Save
End Sub
The core object in the NI AWR SDE is the Project. The NI AWR SDE exposes all of its features as Collections of objects
under the Project Object. The NI AWR SDE Units Collection allows access to the Global Project Units. This script
includes access to the BaseUnitString property of a Unit which provides a string value for the BaseUnit of each unit type.
There is also access to the unit description field via unit property description that gives a full string description of the
unit type, for example, "voltage" or "length" etc.
'Code Module
Sub Main
Dim iCount As Double
Debug.Clear
Dim un As Unit
iCount = Project.Units.Count
Debug.Print "iCount = ";iCount
For Each un In Project.Units
Debug.Print un.MultType;un.MultValue;un.Type;un.UnitString
Debug.Print "Base Unit Str = " & un.BaseUnitString
Debug.Print "Description = " & un.Description
Next un
End Sub
iCount = 17
6 1 0
8 1000000 1 MHz
1 0.000000000001 2 pF
2 0.000000001 3 nH
6 1 4 ohm
6 1 5 S
11 0.0000254 6 mil
11 0.0000254 7 mil
15 1 8 DegC
19 1.74532925199433E-02 9 Deg
2 0.000000001 10 ns
6 1 11 V
4 0.001 12 mA
20 1 13 dBm
4 0.001 14 mW
6 1 15 dB
6 1 16
This code finds each unit object in the Project and prints the values of all units' properties:
MultType - Returns/sets a value that specifies the multiplier type of a Unit object
MultValue - Returns the multiplier of a Unit object
Type - Returns a value that specifies the unit type of a Unit object
UnitString - Returns a string that characterizes the actual name of the unit
Note that the value is returned in the default unit. For example, the default value for capacitance is pF because the
Schematic's default unit is pF.
'Code Module
Sub Main
Dim unit_Ind As mwUnitType
Debug.Clear
Debug.Print Project.Units.Item(mwUT_Frequency).MultType
Debug.Print Project.Units.Item(mwUT_Capacitance).MultType
Project.Units.Item(mwUT_Frequency).MultType = mwUMT_Mega
Project.Units.Item(mwUT_Capacitance).MultType = mwUMT_n
Debug.Print "After changing"
Debug.Print Project.Units.Item(mwUT_Frequency).MultType
Debug.Print Project.Units.Item(mwUT_Capacitance).MultType
End Sub
After changing
You can assign any unit's values for the Project. To convert all units to MKS, use the MultValue property. To make a
calculation in MKS, use the MultValue property as a multiplier. The MultValue is the value needed to go from user units
to base units so:
or:
For example, for a capacitance scale factor to convert, the value would be 1 e -12.
Property Type (DataType - mwUnitType) determines what type of unit object to use. For example, for frequency, you
can use GHz, MHz, KHz, or Hz.
Dim p As parameter
Dim ut As mwUnitType
Dim m As Measurement
ut = p.UnitType
multiplier = MWOffice.Project.Units(ut).MultValue
fstart = CDbl(edStart.Text)
m.xValue = fStart * multiplier
In this example, edStart.Text is the start frequency that you enter into the window's text field.
Note that to set SystemDiagram.Elements(1).parameters("RATE") using ValueAsDouble, the right-hand side value needs
to be in MKS units. In the code:
SystemDiagrams(1).Elements(1).parameters("RATE").ValueAsDouble=1
The RATE parameter is set to "1" Hz. To set the RATE to "1" GHz use:
SystemDiagrams(1).Elements(1).parameters("RATE").ValueAsDouble= 1e9
One feature of the Units collection is that the index variable of the Units.Item() method is a "mwUnitType" so intellisense
in the scripting environment helps you pick the correct value:
mwUT_None 0
mwUT_Frequency 1
mwUT_Capacitance 2
mwUT_Inductance 3
mwUT_Resistance 4
mwUT_Conductance 5
mwUT_Length 6
mwUT_LengthEnglish 7
mwUT_Temperature 8
mwUT_Angle 9
mwUT_Time 10
mwUT_Voltage 11
mwUT_Current 12
mwUT_PowerLog 13
mwUT_Power 14
mwUT_DB 15
mwUT_String 16
mwUT_Scaler 17
mwUT_DBOnlyPower 18
mwUT_WattsOnlyPower 19
Using the multiplication factors and Unit Strings makes it easy to convert value to user units, display them correctly,
and later convert user inputs back to base units for your API application.
'Code Module
Sub Main
'Sets Frequencies to the project
Debug.Clear
Dim vals(20) As Double
Dim freq As Frequency
'Prints all project Frequencies
For Each freq In Project.Frequencies
Debug.Print freq.Value
Next freq
'Trying to manipulate frequency data
For i=0 To 19
vals(i)=2*i*1e8 'Change this statement to set frequency you want
Next i
Project.Frequencies.Clear
Project.Frequencies.AddMultiple(vals)
Debug.Print "After changing "
For Each freq In Project.Frequencies
Debug.Print freq.Value
Next freq
Project.Frequencies.Add(1050000000)
Debug.Print "After setting project frequency "
For Each freq In Project.Frequencies
Debug.Print freq.Value
Next freq
End Sub
To override global Project frequency settings for a particular Schematic, use the following script:
'Code Module
Sub Main
'Sets Frequencies to the Schematic level
Debug.Clear
Dimvals(20) As Double
Dimsch As Schematic
Dimfreq As Frequency
Setsch = Project.Schematics("LINPAR 2 lines")
ForEach freq In sch.Frequencies
Debug.Print freq.Value
Next freq
sch.UseProjectFrequencies = False
For i=0 To 19
vals(i) = 2*i*1e8
Next i
sch.Frequencies.AddMultiple(vals)
sch.Frequencies.Add(1050000000)
Debug.Print "After changing "
For Each freq In sch.Frequencies
Debug.Print freq.Value
Next freq
sch.UseProjectFrequencies = True
Debug.Print "After setting project frequency "
For Each freq In sch.Frequencies
Debug.Print freq.Value
Next freq
End Sub
To override global Project frequency settings for a particular EM structure, use the following script:
'Code Module
Sub Main
Dim Ems As EMStructure
Dim Freq As Frequency
'Clear the output window.
Debug.Clear
For Each Ems In Project.EMStructures
'Print the name of the EMStructure for references.
Debug.Print "EmStructure Name = " & Ems.Name
Debug.Print "Use Project Frequencies="& Ems.UseProjectFrequencies
Debug.Print "Frequency Count= "& Ems.Frequencies.Count
'Try setting the use project frequencies to a value that it is currently not.
Ems.UseProjectFrequencies = False
Debug.Print
'Print the current frequencies.
Debug.Print "*** Frequencies ***"
ListStructureFreqs(Ems)
Debug.Print
Ems.Frequencies.Add(4.0e9)
'Print the current frequencies.
Debug.Print "*** Frequencies ***"
ListStructureFreqs(Ems)
Debug.Print
Ems.Frequencies.Remove(1)
'Print the current frequencies.
Debug.Print "*** Frequencies ***"
ListStructureFreqs(Ems)
Debug.Print
Next Ems
End Sub
Sometimes it is useful to define a global data Element and have all Schematics reference the same Element. This is useful
is when all the Schematics use the same substrate. You can add a substrate definition to the global data definitions and
then all of the Elements in your Schematics can use that substrate.
You can access the Global Definitions as Project.GlobalDataElements object. This object works much like a simplified
Schematic, so you can add Elements and equations in the same way you add them to a Schematic. You can add a substrate
object with the Add() method specifying the MSUB name and the location to place the substrate Element.
After you add the substrate definition to the global definitions you can create a Schematic and add some Elements to
reference it.
' Create schematic with MLIN element that references global substrate
Set schem = Project.Schematics.Add("MySchematic")
Set elem = schem.Elements.Add("MLIN", 0, 0)
schem.Elements.Add("PORT",elem.Nodes(1).x, elem.Nodes(1).y)
schem.Elements.Add("PORT",elem.Nodes(2).x,elem.Nodes(2).y,180)
When you want to define a data Element or equation for all Schematics to use, place that Element in the
Project.GlobalDataElements to make it available to all Elements from all Schematics in the Project.
Remove an Element:
Project..GlobalDefinitionDocuments(1).DataElements.Remove("MSUB.SUB1")
Project.GlobalDataElements.RemoveAll
API methods for accessing the expression values for global equations.
Those methods are for accessing the expression values of equations for equation objects in Global Definition Documents.
Debug.Print expr.Expression
If (expr.DataType = mwEDT_Real) Then
Debug.Print "Real Value = " & expr.ValueAsDouble
End If
End Sub
You can override global Project settings and set your own options for the following main NI AWR SDE objects: Project,
SystemDiagram, Schematic, and EMStructure. You can print a list of all options and properties for a particular object.
'Code Module
Sub Main
Debug.Clear
Dim opt As Option
Dim i As Long
i = 0
For Each opt In MWOffice.Options
i = i + 1
Debug.Print i;vbTab;opt.Name;vbTab;opt.Description;vbTab;opt.DataType;vbTab;opt.Value;vbTab
Next opt
1 ShowTopLevelOnly - Returns/sets if the Project should display only top level Schematic nodes. 11 True True
2 OptionNodesInProject - Returns/sets if options nodes should display in the Project Browser. 11 False False
3 CollapseProjectTreeOnOpen - Returns/sets if the Project Browser should be collapsed on open. 11 False False
4 EvironmentOptionsInProject - Returns/sets if the environment options should be displayed in the Project Browser. 11
False False
This code finds each Option object in the Project and prints values of all options' properties:
Through the Project Object you can access different object's options, for example, Layout options, but on the Project
level you can apply only to all Layouts.
MWOffice.Options(2).Value = True
Project.Options("EnableInterpolation").Value=True
You can change options for the whole Collection of objects (EMStructures, SystemDiagrams) and for the particular
Schematic, SystemDiagram, or EMStructure.
Option modification at the individual system diagram and EMStructure levels is available only if the UseProjectDefaults
property is set to "False". The following is an example that sets options at the SystemDiagram level:
'Code Module
Sub Main
Dim Sys As SystemDiagram
For Each Sys In Project.SystemDiagrams
Debug.Print "System Name = " & Sys.Name
16
16
32
32
64
Note that you can omit the default Item property. The following two lines are equivalent:
Debug.Print Sys.Options.Item("SampleRate")
Debug.Print Sys.Options("SampleRate")
Debug.Clear
For Each atr In MWOffice.Files
Debug.Print atr.Name;vbTab;atr.ValueAsString
Next atr
End Sub
We added a PageSetup object to the API accessible from the Application which provides access to fields such as Margins,
Orientation, PaperSize, Scaling, ScaleFactor and Detail level.
Debug.Print atr.Name;vbTab;atr.Value;vbTab;atr.ValueAsString;vbTab;atr.Type
Next i
End Sub
End Sub
The following script shows how to access the Application LayoutCells collection:
Debug.Clear
Set cels = MWOffice.LayoutCells
For i = 1 To MWOffice.LayoutCells.Count
Set cel = MWOffice.LayoutCells.Item(i)
Set cel2 = MWOffice.LayoutCells.Item(cel.Name)
Debug.Print cel.Name;vbTab;cel.ModuleName;vbTab;cel.Description;vbTab;cel.NumberNodes;vbTab;cel.P
Debug.Print cel2.Name;vbTab;cel2.ModuleName;vbTab;cel2.Description;vbTab;cel2.NumberNodes;vbTab;c
Next i
End Sub
Debug.Clear
Set cellMaps = MWOffice.CellMappings
Debug.Print cellName;vbTab;mapName
Next cellMap
End Sub
AIRIND* AIRIND
BGA* BGA
BORDCAP* BORDCAP
BWIRES2* BWIRES
BWIRES_ML* BWIRES2
CPWTRACE* CPTRACE
CPWLIN* CPW1LINE
CPW2LINA* CPW2LINA
CPW2LINE* CPW2LINE
CPW3LINA* CPW3LINA
CPWABRG* CPWABRGX
CPWALINE* CPWALINE
CPWBEND* CPWBENDX
CPWEG* CPWEG
CPWGAP* CPWGAP
CPWLIN* CPWLINE
CPWLIN* CPWLINX
CPWOC* CPWOC
CPWCS* CPWSC
CPWTAPER* CPWTAPER
CPWTEE* CPWTEEX
DICAP* DICAP
SHORT* DPWRSMP
MTRACENET* ELENET
ENCLOSURE* ENCLOSURE
RECT_PIN* EXP_PIN
MLIN* FM1LIN
CLIN_ASYM_2* FM2CLIN
FMCIND* FMCIND
With PageSetup object we have access to all the fields in the Page Setup dialog such as Margins, Orientation, PaperSize,
Scaling, ScaleFactor and Detail level.
The following shows an example of accessing the fields in the PageSetup object, setting them to new values and printing
a page with the new values. In the example we change the default Landscape to Portrait, change the right and left margins
from 0.5 inches to 2.0 inches:
PrintPageSetup
End Sub
Sub PrintPageSetup
Debug.Print "Left Margin = " & MWOffice.PageSetup.LeftMargin
Debug.Print "Right Margin = " & MWOffice.PageSetup.RightMargin
Debug.Print "Top Margin = " & MWOffice.PageSetup.TopMargin
Debug.Print "Bottom Margin = " & MWOffice.PageSetup.BottomMargin
Debug.Print "Orientation = " & MWOffice.PageSetup.Orientation
Debug.Print "Scale Output = " & MWOffice.PageSetup.ScaleOutput
Debug.Print "Scale Factor = " & MWOffice.PageSetup.ScaleFactor
Debug.Print "Detail Level = " & MWOffice.PageSetup.DetailLevel
Debug.Print "Paper Size = " & MWOffice.PageSetup.PaperSize
Debug.Print "Paper Source = " & MWOffice.PageSetup.PaperSource
Debug.Print ""
End Sub
Left Margin = 2
Right Margin = 2
Top Margin = 0.5
Bottom Margin = 0.5
Orientation = 0
Scale Output = False
Scale Factor = 1
Detail Level = 0
Paper Size = 0
Paper Source = 12
This method we can use for printing Schematic, SystemDiagrams and EMStructures.The method PrintOut() doesn't take
any arguments and likely prints the 2D view of the EMStructure. PrintOutEx(), takes an argument o f type
mwDesignViewType which has options for mwDVT_DesignView2D and mwDVT_DesignView3D. So we recommend
to use PrintOutEx to print either the 2D view or the 3D view of the EM structure document.
The following script shows how to enumerate User Folders in a new Project pane:
' Print the items in the given folder to the output window
Sub DumpUserFolder(obParentFolder As MWOffice.UserFolder, ByVal Tabs As String)
' Display the Name
Debug.Print Tabs & obParentFolder.Name
Tabs = Tabs + " ";
' Display the ChildFolders
Dim obUserFolder As MWOffice.UserFolder
For Each obUserFolder In obParentFolder.Folders
DumpUserFolder obUserFolder, Tabs
Next obUserFolder
' Display the ProjectItems
Dim obProjectItem As MWOffice.ProjectItem
For Each obProjectItem In obParentFolder.ProjectItems
DumpProjectItem obProjectItem, Tabs
Next obProjectItem
End Sub
' Dump a project item to the output window
Sub DumpProjectItem(obProjectItem As MWOffice.ProjectItem, Tabs As String)
' Display the Name
Debug.Print Tabs & obProjectItem.Name
End Sub
The ProjectItem method is another example of accessing the User Folder Project item type from the API. It returns the
actual object, in this case a Schematic or Graph, and any methods of those objects can be called directly. To call methods
of the secondary ProjectItem interface you must first assign the Schematic or Graph to a ProjectItem so VB knows to
use the alternate interface.
The following code creates a number of User folders on a couple levels and then places items from the object into the
folders at various levels. The resulting structure is then traversed and output to verify the structure is created correctly.
End Sub
Sub BuildFolderStructure
Set folder = Project.UserFolders.Folders.Add("Folder1")
folder.ProjectItems.Add(Project.Schematics("Schematic 1"))
End Sub
End Sub
The following script shows how to add a Project item to a folder in a new Project pane. The script assumes you have the
Project items it is adding. You can update the script to Remove everything from the Project, then add a "Schematic 1",
"System Diagram 1" and so on, to successfully add the items.
obProjectItem.TreeNode.Select
' Expand the Schematic node
Dim obTreeNode As MWOffice.TreeNode
Set obTreeNode = obProjectItem.TreeNode
obTreeNode.Expand True
End Sub
Sub EnumNodes(Nodes As MWOffice.TreeNodes, Indent As String)
Dim Node As MWOffice.TreeNode
For Each Node In Nodes
If Node.Visible Then
' Debug.Print Indent & Node.Name
Debug.Print Indent & Node.Text
End If
EnumNodes Node.Children, Indent + " "
Next Node
End Sub
The following script is incorrect. It tries to loop through a Project folder and print the item type in the folder.
The ProjectItem method returns the actual object, in this case a Schematic or Graph, and you can directly call any methods
of those objects. The problem in the code is that it attempts to call methods of the secondary ProjectItem interface. To
call methods of this interface you must first assign the Schematic or Graph to a ProjectItem so VB knows to use the
alternate interface. The following script is correct:
template
linear
0
nonlinear_one_tone
0
nonlinear_two_tone
0
power sweep
5
s11 and s22
5
s21 and S12
5
two tone spectrum
5
The following script shows some Embedded and FilePath properties for System Diagrams, Schematics, and EMStructures
so you can determine which documents are embedded and which are linked. FilePath provides a path to the linked files.
Dim Em As EMStructure
Debug.Clear
Debug.Print "Systems:"
For Each sys In Project.SystemDiagrams
Debug.Print sys.Embedded & ", " & sys.Name & ", " & sys.FilePath
Next sys
Debug.Print
Debug.Print "Schematics:"
For Each schem In Project.Schematics
Debug.Print schem.Embedded & ", " & schem.Name & ", " & schem.FilePath
Next schem
Debug.Print
Debug.Print "EMStructures:"
For Each Em In Project.EMStructures
Debug.Print Em.Embedded & ", " & Em.Name & ", " & Em.FilePath
Next Em
End Sub
Running the script shows that three of the items are embedded and three are linked in the Project. For the linked items,
the FilePath is also printed. This script generates the following output:
Systems:
False, External System Diagram 1, C:\Documents and Settings\mariyetta\My Documents\API_Tests\Embedd
True, System Diagram 1,
Schematics:
False, External Schematic 1, C:\Documents and Settings\mariyetta\My Documents\API_Tests\Embedded_Li
True, Schematic 1,
EMStructures:
True, EM Structure 1,
False, External EM Structure 1, C:\Documents and Settings\mariyetta\My Documents\API_Tests\Embedded
We can access to collection of installed PDKs (the list under File > New With Library...). The new collection is available
from: MWOffice.AvailableProcessLibraries. The script shown further is accessing to the process libraries available on
the system based on the ProcessLibraryManager which is the same place libraries are accessed for New With Library
menu item:
Debug.Clear
Debug.Print "Library Count = " & MWOffice.AvailableProcessLibraries.Count
Next procInfo
End Sub
To display a message in the Status Window you need to associate the message with one of the following groups:
Ungrouped
Addin Manager
Application
Open Access Runtime
Netlist import
The default is the "Ungrouped" group, so to add a message to the top level use just ":"
The following is another example of adding an error message to the Status Window:
API supports opening and closing the status result window on the AWR mainframe window. API also is able to control
the state of the status window with a StatusWindow object associated with the Application.Status object which includes
a visible property that can be used to control the visible state of the Status Results window of the application.
The following is an example of using the mwoffice.status.search() method to look for errors. This method includes the
group name as part of what is searched, so, if the user includes a group name or a portion of the group name the items
in that group will be output:
Set s = Project.Schematics(1)
Set sis = MWOffice.Status.Search(s.Name,mwRIC_Error)
Debug.Print "Number of sim errors found by search: " & sis.Count
End Sub
The NI AWR SDE allows a number of methods of working with DataFile Collections of objects. You can open a new
DataFile, Import, Export, and LinkTo DataFile Collections of objects.
In the NI AWR SDE you can import data files via the API. Each data file that you import displays as a subnode of Data
Files in the Project Browser. The type of imported data file in the NI AWR SDE API is defined by constants as follows:
Dim dt As DataFile
Set dt = Project.DataFiles.Add("SGA-3586","C:\MyScripts\Test_Data\SGA-3586.s2p",True,mwDFT_SNP)
This code adds the "SGA-3586" data file in the Project Browser as a subnode of the Data Files node.
This code adds the "forward" IV data file as a subnode of the Data Files node. Note that you need to specify the file path.
If your file is in the Project or Program directory you can use the following code:
MWOffice.Path
Project.Path
To import a data file into a Project, use the following code. Note that the script uses FileSystemObject for importing
files from the Scripting folder. When using FileSystemObject, do not forget to reference the Scripting Runtime library.
After adding DataFile to the NI AWRDE you can write code and use all methods and properties that the API exposes to
perform the following operations:
Project.DataFiles.Remove(Index)
Project.DataFiles.Remove("Name")
The following code does not work. Assume that there are four data files in the Project that you want to remove. After
the code deletes two files, only two files remain. As the loop iterates, the next time it tries to delete a file, it tries to
delete the third file, which now does not exist, so an error is generated.
For i = 1 To Project.DataFiles.Count
Project.DataFiles.Remove(i)
Next i
Set dt = Project.DataFiles(1)
dt.Name = "MyName"
Set the read-only state of a data file through the ReadOnly property of the DataFile object.property as follows:
Project.DataFiles("MyName").ReadOnly = True
Enter the information into a new DataFile or change the content of the DataFile:
Project.DataFiles(1).DataAsText ="6100000000 -8.60 140.00 10.93 -18.21 -14.00 7.00 -8.51 108.90"
View the content of the DataFile using the PrintOut method or print DataFile to the Immediate Window using the
Debug.Print method:
Debug.Print Project.DataFiles(1).DataAsText
The DataFile object method called DataAsText is a read-write method. With this method you could do something like:
Set d1 = Project.DataFiles(1);
content = d1.DataAsText
The method also supports write so you could add a content from one DataFile to another:
d2.DataAsText = content
Access Datafile options. The API contains the Options collection of the DataFiles collection that provides access to
the options displayed on the Raw Data Format and MDIF Files tabs of the Data File Options dialog box. The API has an
object, associated with the Data Files node in the Project. That object has an Options property associated with the
DataFiles collection and allows getting and setting options for raw data files and MDIF variable sorting order.
Project.DataFiles.Options(1)=0
Project.DataFiles.Options(2)=1
Project.DataFiles.Options(3) = 19
Project.DataFiles.Options(4) = 9
Project.DataFiles.Options(5) = 4
Project.DataFiles.Options(6) = 50
Project.DataFiles.Options(7)=True
Project.DataFiles.Options(8) = False
Project.DataFiles.Options(9) = False
fn = Project.Path & "tt14344_4port.prn"
Project.DataFiles.Import("test",fn,mwDFT_RAW)
End Sub
Debug.Clear
For Each opt In Project.DataFiles.Options
Debug.Print opt.Name & " = " & opt.Value & ", " & opt.Description
Next opt
End Sub
The following code displays in the Debug window the type of each data file loaded in the program:
'This helps distinguish touchstone, from raw data, from regular text files.
Dim dat As DataFile
Sub Main
Debug.Clear
Debug.Print "filename";vbTab;"data type"
'Debug.Print ""
For Each dat In Project.DataFiles
Select Case dat.Type
Case 0
Dim i As Integer
Dim grafName As String
grafName="ModelError"
Project.Graphs.Add(grafName,mwGT_Rectangular)
Project.Graphs.Item(grafName).Legend.Visible=False
For i=1 To Project.DataFiles.Count
Project.Graphs.Item(grafName).Measurements.Add (Project.DataFiles.Item(i).Name,"DB(SModel
'Project.Graphs.Item(grafName).Measurements.Add (Project.DataFiles.Item(i).Name,"K")
'Project.Graphs.Item(grafName).Measurements.Add (Project.DataFiles.Item(i).Name,"S[2,2]")
'Project.Graphs.Item(grafName).Measurements.Add (Project.DataFiles.Item(i).Name,"S[1,1]")
'Project.Graphs.Item(grafName).Measurements.Add (Project.DataFiles.Item(i).Name,"S[1,2]")
Next i
The API also exposes the following methods to add data files to the Elements collection:
* Add DataFile
The following code adds DataFile to the Schematic("MySchematic").Elements, and the "Schem1.s2p" subnode displays
under the Schematic("MySchematic") node:
Sub Main
'Add Model File Element
'This script demonstrates how to add a model file element using the API 'method
'Schematic.Elements.AddModelFile().
The following code also adds a Subcircuit to a Schematic Subcircuits collection (both methods are identical).
project.Schematics(2).Subcircuits.Add("A",0,0)
Note that "MySchematic" Schematic and "MySubcircuit" subcircuit must already exist, as in the following code:
'Code Module
Sub Main
'Add XML Component
'Demonstrates adding two XML file components to a schematic using the ' API method Schematic.Eleme
Dim schem As Schematic
Dim elem As Element
Dim xPath As String
'Get a reference to the schematic
Set schem = Project.Schematics("MySchematic")
'Place an initial resister XML componentschem.Elements.AddXMLComponent ("$LIB_DIR\Motorola\METLDMO
End Sub
You must explicitly write the x and y coordinates on the code if you add DataFile to a Schematic. These coordinates
show the NI AWR SDE where to put the model, subcircuit, and XMLComponent on the schematic.
You can explore the hierarchy of libraries using the following code:
'Code Module
'Globals
Dim x As Double, y As Double
'Main routine
Sub Main
Dim objLibs As Libraries
Dim objLib As Library
Dim schem As Schematic
Dim Message As String
On Error Resume Next
x = 0
y = 0
Debug.Clear
Set schem = Project.Schematics("MySchematic")
'Set objLibs = MWOffice.Application.Libraries("Circuit Elements").Libraries("XML Libraries").
Libraries("Johanson Technology").Libraries
Set objLibs = MWOffice.Application.Libraries("Circuit Elements").Libraries("XML Libraries").
Libraries(1).Libraries(2).Libraries(4).Libraries(1).Libraries
For Each objLib In objLibs
ProcessLibrary objLib, schem
Next objLib
End Sub
Sub ProcessLibrary (ByRef objLib As Library, ByRef schem As Schematic)
Dim objLibrary As Library
Dim objElem As LibraryElement
For Each objElem In objLib.LibraryElements
Debug.Print objElem.Name
schem.Elements.AddLibraryElement(objElem.BrowserPath, x, y)
x = x + 1000
If (x > 50000) Then
x = 0
y = y + 1000
End If
' Debug.Print schem.Elements(1).Name
schem.Elements.Remove(1)
Next objElem
To load a new library use NI AWR SDE access to the NewWithProcessLibary function.
If we need to create an output file using api we need first to look how we create an output file in AWR DE. We use
ADD/Modify Output File Dialog. In our API code we need to provide values for all parameters used at this dialog.
The following scripts demonstrate how to add some types of data files to the Project, and the method, and property to
print out the Output DataFile string.
Debug.Clear
schName(1) = "NPORTF_S_dB"
schName(2) = "NPORTF_S_Mag"
schName(3) = "NPORTF_S_Real"
schName(4) = "NPORTF_Y_Mag"
schName(5) = "NPORTF_Z_Mag"
measStr = "NPORTF(" & parType(1) & "," & datType(3) & "," & prec & ",50,1,1," & schName(1) & filex
prec = "8"
measStr = "NPORTF(" & parType(1) & "," & datType(2) & "," & prec & ",40,1,1," & schName(2) & filex
prec = "5"
measStr = "NPORTF(" & parType(1) & "," & datType(1) & "," & prec & ",50,1,1," & schName(3) & filex
measStr = "NPORTF(" & parType(2) & "," & datType(2) & "," & prec & ",50,1,1," & schName(4) & filex
measStr = "NPORTF(" & parType(3) & "," & datType(2) & "," & prec & ",50,1,1," & schName(5) & filex
End Sub
NPORTF(1,3,5,50,1,1,NPORTF_S_dB.s1p,1)
NPORTF(1,2,8,40,1,1,NPORTF_S_Mag.s1p,1)
NPORTF(1,1,5,50,1,1,NPORTF_S_Real.s1p,1)
NPORTF(2,2,5,50,1,1,NPORTF_Y_Mag.y1p,1)
NPORTF(3,2,5,50,1,1,NPORTF_Z_Mag.z1p,1)
NOTE:Keep in mind that the option to Write into Project Data Files should be checked if you need to import output
files back to the project and look at the results in the graph (See last "1" in filext() array). You need to be aware that the
files imported end up having 1 appended to the names because they are automatically renamed in MWOffice because
the name of the data file is the exact same as the name of the source schematic. You can set the results graph measurements
accordingly to avoid errors.
The following script demonstrates how to set Output Files for System Diagram RFA_TDR measurement:
Debug.Clear
sch_name = Project.SystemDiagrams(1).Name
meas = "RFA_TDF("
intp = "PORT_1"
outtp = "PORT_2"
output_type = "NL_F,Power"
prec = "6"
modif = "dB("
meas_Str = modif & meas & intp & "," & outtp & ",0" & "," & prec & "," & Chr$(34) & "PORT_use_RFA_
End Sub
F Chain:DB(RFA_TDF(PORT_1,PORT_2,0,6,"PORT_use_RFA_TDF_test",0))
sch_name = Project.SystemDiagrams(1).Name
meas = "RFA_TDF("
intp = "TP.IN"
outtp = "TP.OUT"
output_type = "NL_F,Power"
prec = "6"
fil_name = "swept_output_RFA_TDF_test"
meas_Str = meas & intp & "," & outtp & ",0" & "," & prec & "," & Chr$(34) & "swept_output_RFA_TDF_
Pwr Sweep:RFA_TDF(VNA.VNA1,VNA.VNA1,1,6,"VNA_pwr_sweep_RFA_TDF_test",0)
sch_name = Project.SystemDiagrams(1).Name
meas = "RFA_TDF("
intp = "VNA.VSA1"
outtp = "VNA.VSA1"
output_type = "NL_F,Power"
prec = "6"
meas_Str = meas & intp & "," & outtp & ",0" & "," & prec & "," & Chr$(34) & "VNA_freq_sweep_RFA_TD
Freq Sweep:RFA_TDF(VNA.VSA1,VNA.VSA1,0,6,"VNA_freq_sweep_RFA_TDF_test",0)
The NI AWR SDE API allows you to access the Symbols Collection. You can create and edit Symbols, and export them
to a Symbol (.syf) file. You can also import existing Symbols into your Project and edit them.
To create a new Symbol, use an intermediate object called a Symbol record. All Shapes need to be added to the Symbol
record object. The following multi-step process is required:
The following code shows an example of creating a Schematic Symbol using AddNode, AddLine, Add Polygon, and
AddText methods:
You can also use the AddArc, AddEllipse, and AddPolyline methods.
In the NI AWRDE you can choose Project > Circuit Symbols > Manage Symbols and select the Symbol named
"CustomSymbol" from the list to view the new Symbol, as shown in the following figure.
The Symbol created with this code is saved to a customSymbols.syf file. You can also use Export and Import methods
from Symbol Collection.
You can create multiple Symbols with different names, with the same set of Shapes, because the Symbol name is associated
with the Shapes and nodes in the Symbol record in the CreateSymbol call.
To set the default Symbol name for a Schematic, use the following option from the Schematic Options collection:
Method Project.Symbols.GetDefaultSymbol (long NumNodes) returns a Symbol object representing the default for the
number of nodes. The following script is an example of getting the default Symbol for a given number of nodes:
Sub Main
Dim Symb As Symbol
Dim SymbShape As SymbolShape
Dim Index As Integer
Debug.Clear
Set Symb = Project.Symbols.GetDefaultSymbol(2)
Debug.Print "Symbol Name = " & Symb.Name
Debug.Print "Symbol Nodes Count = " & Symb.Nodes.Count
Debug.Print "Symbol Shape Count = " & Symb.Shapes.Count
Index = 1
For Each SymbShape In Symb.Shapes
Debug.Print "Shape " & Index & " point count = " & SymbShape.Points.Count
Index = Index + 1
Next SymbShape
End Sub
As the previous examples show, a Symbol object contains Shapes and Nodes collections, allowing you to access the
SymbolShapes and SymbolNodes of a Symbol object. From a SymbolShape object you can get the type, points, and
attributes of a Shape. From a SymbolNode object you can get the x and y offset into the Symbol as well as the node label
text. From the Symbol.Boundary object you can get Left, Right, Top, and Bottom of the Boundary for the Symbol.
The API exposes the Symbol property of an Element object, so you can change the Symbol associated with an electrical
Element.
To access the Shapes of a Symbol associated with a Schematic Element, you need to get the name of the Symbol from
the Element and then use the name as an index for a Symbols collection associated with the Project. This gives you a
Symbol object from which you can get the Shapes and nodes.
'Code Modules
Sub Main
Dim Sch As Schematic
Dim Ele As Element
Debug.Clear
For Each Sch In Project.Schematics
Debug.Print "Schematic = " & Sch.Name
For Each Ele In Sch.Elements
Debug.Print "Element Name = " & Ele.Name
OutputSymbolDetails(Ele.Symbol)
Next Ele
Debug.Print
Next Sch
Debug.Print
End Sub
Sub OutputSymbolDetails(ByRef SymbolName As String)
Dim Sym As Symbol
Dim Shp As SymbolShape
Dim Attr As Attribute
Dim Nde As SymbolNode
Dim i As Integer
Next at
End Sub
Schematic = Schematic 1
Element Name = PORT.P1
Symbol Name = Port@system.syf
ShapeCount = 6
Node Count = 1
*** Shapes ***
Shape[1] Type = 0
Point[0] = (0, 0)
Point[1] = (-100, 0)
Shape[2] Type = 0
Point[0] = (-100, 0)
Point[1] = (-200, -100)
Shape[3] Type = 0
Point[0] = (-200, -100)
Point[1] = (-250, -100)
Shape[4] Type = 0
Point[0] = (-250, -100)
Point[1] = (-250, 100)
Shape[5] Type = 0
Point[0] = (-250, 100)
Point[1] = (-200, 100)
Shape[6] Type = 0
Point[0] = (-200, 100)
Point[1] = (-100, 0)
*** Nodes ***
Node[0] = (0, 0 )
Option Explicit
Sub Main
'make a new symbol record
Dim symrec As SymbolRecord
Set symrec = Project.Symbols.CreateSymbolRecord
'draw a box and add 2 nodes
symrec.AddLine(0, 0, 1000, 0)
symrec.AddLine(1000, 0, 1000, 1000)
symrec.AddLine(1000, 1000, 0, 1000)
symrec.AddLine(0, 1000, 0, 0)
symrec.AddNode(0,500, 50, 50, True)
symrec.AddNode(1000, 500, 50, 50, True)
'make a new symbol, find an available name, create it with the symbol record
Dim newSym As Symbol
Dim symbName As String
symbName = NewSymbName("NewSymbol")
Set newSym = Project.Symbols.CreateSymbol(symbName, symrec)
'make a schematic, add an MLIN, and set the new symbol as the mlin symbol
Dim sch As Schematic
Set sch = Project.Schematics.Add("newSchem")
sch.Elements.Add("MLIN", 0, 0, 0, False, symbName)
The following script creates a symbol with edge select only mode enabled. The newly created symbol associates with
an element in a schematic and code prints out the attributes of the symbol after it is created:
Sub Main
Dim symbName As String
symbName = "MySymbol"
schemName = "MySchematic"
CreateProjectSymbol(symbName)
CreateSymbolElement symbName, schemName
PrintSymbolDetails(symbName)
PrintElementDetails(schemName)
End Sub
Sub CreateProjectSymbol(symbName As String)
Dim symbRec As SymbolRecord
Dim symb As Symbol
If Project.Symbols.Exists(symbName) Then
Project.Symbols.Remove(symbName)
End If
End Sub
End Sub
To extract the Shapes for a Symbol associated with a SystemDiagram Element, use the following script:
'Code Module
Sub Main
Dim Sys As SystemDiagram
Dim Ele As Element
Debug.Clear
For Each Sys In Project.SystemDiagrams
Debug.Print "SystemDiagram = " & Sys.Name
For Each Ele In Sys.Elements
Debug.Print "Element Name = " & Ele.Name
OutputSymbolDetails(Ele.Symbol)
Next Ele
Debug.Print
Next Sys
Debug.Print
End Sub
To export a Symbol to the Project, use the Export method and show the full path to the .syf file.
' Create a Schematic and Place an element using our new symbol.
Dim schem As Schematic
Dim elem As Element
Set schem = Project.Schematics.Add("MySchematic")
' Mlin used because it has two ports, the model used
' is not important to this demonstration.
schem.Elements.Add("MLIN", 0, 0, 0, False, "MySymbol")
The API also supports Symbol (via the Options collection) for EM and System Diagrams and DataFiles:
End Sub
The API has access to the default Symbol for DataFiles (in the Options collection "SchematicSymbolName").
SchematicSymbolName also sets the default Symbol name used when a Document is placed as a Subcircuit.
The following script uses a system symbol and associates it with an element which is different than the default system
symbol for that element, so, that it's clear that the symbol was explicitly associated rather than just having the default:
symbName = "TLINE@System.syf"
schemName = "MySchematic"
End Sub
' Create a RES element but associate a MLIN symbol with it.
Set schem = Project.Schematics.Add(schemName)
schem.Elements.Add("RES", 0, 0, 0, False, symbName)
End Sub
End Sub
The following code prints out boundary property for the symbols shapes. The code creates a symbol with a number of
different shapes in it and then traverses the shapes of the resulting symbol and dumps the boundary values of each shape
:
symbName = "MySymbol"
schemName = "MySchematic"
CreateProjectSymbol(symbName)
CreateSymbolElement symbName, schemName
PrintSymbolDetails(symbName)
PrintElementDetails(schemName)
End Sub
If Project.Symbols.Exists(symbName) Then
Project.Symbols.Remove(symbName)
End If
Project.Symbols.CreateSymbol("MySymbol", symbRec)
End Sub
Debug.Print ""
End Sub
Next elem
End Sub
The following code creates symbol with offset.In the code symbols created with the standard symbol record API methods
also get offset such that the resulting symbol has node 1 at 0,0. This code intentionally applies an offset to each symbol
coordinate including the node positions and then verifies that the nodes and shapes have been correctly offset to remove
the intentional offset and place node 1 at 0,0:
symbName = "MySymbol"
schemName = "MySchematic"
CreateProjectSymbol(symbName)
CreateSymbolElement symbName, schemName
PrintSymbolDetails(symbName)
PrintElementDetails(schemName)
End Sub
If Project.Symbols.Exists(symbName) Then
Project.Symbols.Remove(symbName)
End If
off = 100
End Sub
Debug.Print ""
End Sub
When the symbol object is created the cached objects are offset so that node 1 will be located at 0,0 and the other shape
will be relative to this according to their original locations.
The NI AWR SDE API allows you to access all api commands that can be used with InvokeCommand() statement. You
can run the following script and see all commands names. The text file will be under C: directory. You can also set the
Path you need in the code
Option Explicit
'Description=Returns a text file with a categorized list of every API command. Currently set to pu
' Code Module
Sub Main
Open("c:\commands.txt") For Output As #1
Dim objTable As CommandTable
Dim cmd As Command
End Sub
Dim s As Schematic
For Each s In Project.Schematic
Debug.Print s.Name
Next s
You can access a specific Schematic by name or by index like each Element in the collection of objects:
Dim s As Schematic
Set s = Project.Schematics("Master")
or
Set s = Project.Schematic(1)
This code assigns the Schematic named "Master" to the variable s or you can say that s is a reference to the Schematic
named "Master".
After you have a reference to a specific Schematic object you can perform the following actions:
As described in a previous section, you can configure via the API Schematic options that control all specific settings for
a particular Schematic. You can explore the whole collection of Schematic options and set a particular option to a new
value.
'Code Module
Sub Main
Dim scm As Schematic
Dim opt As Option
Debug.Clear
Set scm = Project.Schematics("Filter")
For Each opt In scm.Options
Debug.Print opt.Name;vbTab;opt.Value
Next opt
End Sub
NumberTone1Harmonics 4
NumberTone2Harmonics 4
NumberTone3Harmonics 4
MaximumHarmonicIterations 1000
RelativeConvergenceError 0.001
AbsoluteConvergenceError 0.0000001
HarmonicZeroTolerance 0.001
HarmonicExponentialZeroTolerance 0.0001
NyquistSampleMixSetting 0
LimitHarmonicOrder True
MaximumHarmonicOrder 9
OversamplingRate 2
UseFrequencyMap False
LinearSolveType 0
UseIncrementalSolve True
SourceStepSizeDb 2
SourceStepReduceDb 40
UseSourceStepping True
SpiceModelLevel 3
iNetModelLevel 0
ModelVersionNumber 650
Hideparameters False
HideparameterUnits False
HideparameterIfEmpty False
HideparameterVarName False
LeftJustifyparameters False
BoldparameterFont False
HideElementNames False
BoldElementFont False
LeftJustifyElementName True
HideSecondaryparameters True
SymbolLineThickness 0
BlackAndWhite False
DependentparametersInBaseUnits False
SignificantparameterDigits 4
parameterZeroThreshold 1E-30
The key to changing options at the individual Schematic level is to make sure the UseProjectDefaults property is set to
"False". The following example sets them at the Schematic level:
Sub Main
Dim s As Schematic
For Each s In Project.Schematics
Debug.Print "Schematic Name = " & s.Name
'Set the options to use the local schematic options.
s.UseProjectOptions = False
'Print the current value of the MaximumHarmonicOrder
Debug.Print s.Options.Item("MaximumHarmonicOrder")
'Double the MaximumHarmonicOrder.
s.Options.Item("MaximumHarmonicOrder") = 2 * s.Options.Item("MaximumHarmonicOrder")
'Print the updated value.
Debug.Print s.Options.Item("MaximumHarmonicOrder")
Next s
End Sub
Schematic.Options :
Project.Schematics.Options.Count = : 18
Schematic Name = Filter
9
18
Schematic Name = New Schematic
9
18
Schematic Name = Schematic 1
9
18
The key to changing frequencies at the individual Schematic level is to make sure the UseProjectFrequencies property
is set to "False".
The method which sets the state for options associated with a document includes the dynamically loaded options. This
addresses the additional pages, like the APLAC Sim, HSPICE Sim, and Spectre tabs on the Options dialog box.
To set the defaults for the whole Schematics collection (Global Circuit Options) on the Project level you need to access
the Options collection directly from the Schematics collection.
Sub Main
Dim op As Option
Debug.Clear
For Each op In Project.Schematics.Options
Debug.Printop.Name;vbTab;op.Value;vbTab;op.Description
Next op
End Sub
Project.Schematics.Options("HarmonicZeroTolerance") = 0.005
Set s = Project.Schematics.Add("Filter")
If a Schematic named "Filter" already exists, the new Schematic is named "Filter1".
Project.Schematics.Remove("Filter")
Project.Schematics.Import("Filter1",Project.Path + "Filter.sch")
This fragment of code finds the file (with the extension *.sch) and adds the Schematic to the Project Browser under the
name "Filter1". This method and the "LinkTo" method accept a Name under which you create the Project Browser node
and File Path to the import.
To link to a file that contains the Schematic, use the following code:
Setrf=Project.Schematics.LinkTo("Filter1",Project.Path + "Filter.sch")
This code adds a Schematic object link to the collection from a file (the linked schematic file has a *.sch extension) and
returns a reference to the created object.
NOTE: The Import method embeds the document into the Project while the LinkTo method retains a reference and
displays the reference in the Project Browser node name.
You can also perform a Copy to Clipboard operation in the script by using the CopyToClipboard method.
Project.Schematics("Filter").CopyToClipboard
When the script stops, the "Filter" Schematic stays on the Clipboard.
Exporting a Schematic
This code finds the Schematic ("Filter") and writes a Filter.sch file to the Project directory.
In the ExportNetlist example, the method takes two arguments (FilePath as String is the location in which you want to
place the NetList, and Constant defines the type of Schematic netlist export format).
Project.Schematics("Filter").PrintOut
The API allows you to browse through a comprehensive database of hierarchical groups of electrical models and print
out all information about the model, such as name, description, category, symbol name, company name, and model level.
You can browse through Elements manually within the Element Browser, and programmatically via the API.
Sub Main
On Error Resume Next
Debug.Clear
Dim m As Model
Dim sch As Schematic
Set sch = Project.Schematics("Test")
If sch Is Nothing Then
Set sch = Project.Schematics.Add("Test")
End If
For Each m In MWOffice.Models
If Left(m.Name,1) <> "_" Then
sch.Elements.Add(m.Name,0,0)
sch.Elements.Remove(1)
Debug.Print m.Name;vbTab;"Cat-ry=";m.Category(1);vbTab;"Levels=";m.Levels;vbTab;Module=";
m.Module;vbTab;"Symbol= ";m.Symbol;vbTab;"Version = ";m.Version
Debug.Print "Company = ";m.Company;vbTab;"Description =";m.Description;vbTab;"HelpContext=";m.He
End If
Next m
End Sub
MPSUB Cat-ry = MPSUB Levels = 1 Module = unknown Symbol= MPSUB@MLINES.SYF Version = 1 Company
Company = AWR Description = Microstrip Substrate Definition HelpContext = 5110 HelpFile = MSUB2
Company = AWR Description = Two-Layer Microstrip Substrate Definition HelpContext = 5505 HelpF
You can programmatically perform the same operations with Elements as you can manually:
The following function returns the selected Elements in the active Schematic for use with scripts that work on selected
Schematic Elements. This code uses the active Schematic function. The NI AWRDE supports getting the collection of
selected Elements directly, so enumerating the Elements is no longer necessary:
awrSchGetSelected = elementList
End Function
el = awrSchGetSelected()
The following is an example of using DisplayMode Function that returns False or True:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Set schem = Project.Schematics("SCH1")
End Sub
Once you have access to a Schematic you can iterate through the Elements collection as usual:
This code example creates a new Schematic named "Master" and places resistors on it.
Note that the Add method contains the Element x and y coordinates. In this example, each resistor connects to its neighbor
without a wire. To connect Elements via wire you need to use the Wires collection of objects.
The following script shows how to use InvokeCommand() methods to add an Element to schematic and Undo/Redo the
adding:
Sub Main
Dim schem As Schematic
End Sub
coutn = 0
Debug.Print " *** " & title & " *** "
Debug.Print "Element Count = " & schem.Elements.Count
Debug.Print "Elements: "
For Each elem In schem.Elements
Debug.Print " Name = " & elem.Name
Next elem
Debug.Print ""
End Sub
Note that to Undo the adding we need to Select All Elements in schematic and Freeze all Elements.
The following script shows how use the API InvokeCommand method to InsertWire. This method should be used if we
need to use Undo method after inserting a wire in some cases, because only command invocations support Undo:
Debug.Clear
Set schem = Project.Schematics("Schematic 1")
Set port1 = schem.Elements("PORT.P1")
Set port3 = schem.Elements("PORT.P3")
x1 = port1.Nodes(1).x
y1 = port1.Nodes(1).y
x2 = port3.Nodes(1).x
y2 = port3.Nodes(1).y
End Sub
Debug.Print title
Debug.Print "Flight Lines"
For Each phys In schem.Layout.PhysicalNets
Debug.Print phys.Name & ", Flight Line Count = " & phys.FlightLines.Count
Next phys
Debug.Print
End Sub
This script inserts the wire via InvokeCommand between the node on Port 1 and the node on Port 3, then checks for
flight lines and then undo the wire insertion and checks again for flight lines.
The following script shows how to create Electrical Nets (Do not forget to use the updateConnectivity() command):
Do you know what is SetupConnectivity method, and how does that differ from UpdateConnectivity? SetupConnectivity
ensures that the node numbers are assigned on the node elements of a schematic so after rewiring things this will ensure
that the numbers are unique for simulation. Update connectivity forces an update to the electrical nets ensuring that they
keep track of the elements that are connected together. They are the electrical side of the connectivity for layout. For
example, the layout knows which PCells to draw flight lines to because the electrical nets in the schematic tell it what
elements are connected together. The electrical nets also provide the schematic side of inets, the electrical net is the
element for the inet layout.
Use the LockUpdates property when you are adding more then 500 Elements to the Schematic. This property locks wire
connectivity updating and speeds Element addition.
MySchematic
PCONN1
MyName
PCONN1
MyName2
port.Parameters("Name").ValueAsString = "IN[0:3]"
To access the Bus and Bundle information shown in the following figure, use the following script:
MySchematic
Wire [1] x1 = -800, y1 = -200 x2 = 700, y2 = -200 Has BusNetName = True
If (seg.HasBusNetName) Then
PrintBusNetName seg.BusNetName, "Before Add"
Else
Debug.Print "Before No Bus Net Name"
Debug.Print ""
End If
If (seg.HasBusNetName) Then
PrintBusNetName seg.BusNetName, "After Add"
Else
Debug.Print "After No Bus Net Name"
Debug.Print , ""
End If
wNet.Wires(1).Selected = True
PrintWireSelectState schem, wNet, "Set First Selected"
wNet.Wires(2).Selected = True
PrintWireSelectState schem, wNet, "Set Second Selected"
Debug.Print title
' Test getting the selected state for each wire segment.
propCount = 0
For Each objWire In schem.Wires
If objWire.Selected Then
propCount = propCount + 1
End If
Next objWire
' Check that the prop count and the collection count agree.
If propCount = schem.SelectedWires.Count Then
Debug.Print "Prop Selected Count Matches Selected Wires Count"
Else
Debug.Print "Prop Selected Count Does Not Match Selected Wires Count"
End If
End Sub
The previous code is selecting wires through the SelectedWires collection using the Selected property from a segment
from a wire net
To print out each object's font size, use the following code:
If sch.DrawingShapes(i).Type = 5 Then
Debug.Print sch.DrawingShapes(i).Attributes(2).ValueAsString & ": " & sch.DrawingShapes(i).Attr
End If
Next i
Next sch
The following code demonstrates ElementVector Instance Access. The vector instance property isnt really part of the
parameters. It is an individual property but we allow editing it through the ID parameter on the element. Normally it is
edited through the Element Properties dialog Vector tab. So, this is the same property we are accessing through the
element.VectorInstanceName property in the API. You can set the VectorInstranceName property to the same values
that would go into this dialog. Here is the example code:
Schematic 1
Vect Inst Name Before = [0:3]
Vect Inst Name After = [1:5]
Drawing Object Count = 5
You can create a cell for some element like inductor and associate created cell with the layout of inductor Element, for
example:
noOfInductors = 1
For n = 1 To noOfInductors
' create cell instance
Debug.Print "define cell name"
cellName = "IND_" + CStr(n)
Debug.Print "Create new cell: " + cellName
Set MyCell = MyCellLib.Cells.Add(cellName)
' associate the new cell with the layout of the schematic inductor (IND) element
Ele.CellName = cellName
Next n
You can change the Symbol associated with a Schematic Element, for example:
Sub Main
Dim Schem As Schematic
Dim Ele As Element
Debug.Clear
Set Schem = Project.Schematics("Master")
Debug.Print Schem.Elements(1).Symbol
Schem.Elements(1).Symbol = ("C:\My6scripts\Symbol\customSymbols.syf")
Debug.Print Schem.Elements(1).Symbol
End Sub
Resistor@SYSTEM.SYF
C:\My6scripts\Symbol\customSymbols.syf
Note:We allow schematic and system diagram symbols to have rotated text. Currently the rotation can only be specified
using the new API method AddText2. (Rotated text cannot yet be added through the symbol editor GUI.) We still display
the text in the schematic in only two orientations (left-to-right or bottom-to-top). After the rotation via API when drawing
text in the symbol editor,we display it at the specified angle and correctly calculate the bounding box.
To Set/Get Default Symbol Name on a Schematic, you can use the Schematic option that sets the name of the Schematic
symbol. For example, the following script sets the symbol name to MSTEP@system.syf:
You can access the Font attribute of text in schematic as in the following example:
End Sub
To rotate an Element you must explicitly set the optional Angle parameter to a specified value as in the previous example.
You can omit the Angle parameter by default.
To flip the Element you must explicitly set the optional Flipped parameter to "True". You can omit the Flipped parameter
by default.
To disable an Element, set the Enable property to "False". To select an Element, set the Selected property to "True". You
can use these settings, for example, to highlight a found Element after successfully searching a large Schematic, or all
Schematics in the Project.
When working with Elements, you normally want to access the parameter values of each Element. Each parameter has
several properties, the most important of which are the parameter Name and ValueAsDouble, which returns the numeric
value.
The following example demonstrates how to iterate through the collections of Elements and collection of parameters.
Debug.Print
Next ele
Note that the value is returned in the default unit. In C1, the value is 0.03988 pF since the default unit in the Schematic
is set to "pF". As discussed previously, you can access default units via Project.Units. You can determine the capacitance
scale factor with the following statement:
Project.Units(mwUT_Capacitance).MultValue
Dim Z0 As Double
Dim g As Double
Dim ele As Element
Dim schem As Schematic
Dim p As parameter
Z0 = 50
g = 1
Set schem = Project.Schematics("Filter")
Set ele =schem.Elements.Add("PORT",dx*j,0,0)
ele.parameters("Z").ValueAsDouble=g*Z0
Set ele = schem.Elements.Add("CAP",dx,0,-90)
ele.parameters("C").ValueAsDouble= 2*g
Set ele =schem.Elements.Add("Res",0,0,0)
Set p = ele.parameters("R")
p.ValueAsString = "X"
This example sets parameter values for different Elements and demonstrates how to access the value of a parameter as
either a number (ValueAsDouble) or a string (ValueAsString).
If an Instance of a subcircuit is placed in a Schematic you must have inherited Connection access:
Schematic 2
SUBCKT.S1
ID
NET
M
PCONN1
PCONN2
PCONN3
Element parameters accept a range of different types on the right side of the equal sign. These can be integers, enumerations,
doubles, equations, strings, or other. The right side of the equation is not always a valid double or even convertible to a
double value, however, a large percentage of the parameter values have a double value, so it is convenient to be able to
ask for the double value directly. The primary differences are:
"ValueAsString" gives you the literal text on the right side of the equation regardless of the type.
"ValueAsDouble" scales the value into base MKS units if the parameter value can be evaluated to a double value or
gives you zero otherwise.
The following script outputs the parameter values for the following Schematic:
Sub Main
Dim schem As Schematic
Dim param As Parameter
Dim elem As Element
Debug.Clear
Set schem = Project.Schematics("MySchematic")
Set elem = schem.Elements(1)
For Each param In elem.Parameters
If (param.ParameterDefinition.DataType <> mwPDDT_DataModel And param.ParameterDefinition.DataTyp
Debug.Print param.Name & " Value As Double = " & param.ValueAsDouble & " Value As String = " & p
End If
Next param
End Sub
The first line in the output gives the output for the ID parameter. The parameter ID has no double value equivalent, so
while ValueAsString is returned as TL1, the ValueAsDouble returned is zero.
The second line in the output gives the values for the width parameter. On the Schematic, the width parameter value is
derived from the equation W1 = 40. ValueAsString gives the equation string for the parameter. ValueAsDouble evaluates
the equation, scales the value from user units to base MKS units, and outputs the value in meters.
The third line in the output gives the values for the length parameter. Here ValueAsString gives the value 500, which is
the length value in user units of microns. ValueAsDouble scales the value to base MKS units and prints the length in
meters. Another key difference between the two regards setting the values for parameters. You can use ValueAsDouble
only to set the parameter to a double value, whereas you can use ValueAsString to set the parameter right-hand side
(RHS) text to any value. To set the width parameter to a different equation value you could use:
You can set the Style property for the Element parameter object to allow a display/hide parameter. The following script
demonstrates how to use the Style property to hide the variable name for all Elements of all Schematics in the Project.
param.Style(mwPS_HideVarName) = mwPSS_SetStyle
Next param
Next elem
Next schem
End Sub
Element parameters can be complex. Use Parameter.ValuesAsComplex property on the parameter object to provide
access to complex parameter values. The following is an example of some code that can traverse the elements of a
schematic and produce values for double and complex parameter types:
Debug.Clear
For Each elem In Project.Schematics("Schematic 1").Elements
Debug.Print elem.Name
For Each param In elem.Parameters
Debug.Print "Param Name = " & param.Name
Debug.Print "Value as String = " & param.ValueAsString
If (param.ParameterDefinition.DataType = mwPDDT_Complex) Then
Debug.Print "Value as Complex = " & param.ValueAsComplex.Real & ", " & param.ValueAsComplex.Ima
Else
Debug.Print "Value as Double = " & param.ValueAsDouble
End If
Debug.Print
Next param
Next elem
End Sub
PORT.P1
Param Name = P
Value as String = 1
Value as Double = 1
Param Name = Z
Value as String = z
Value as Complex = 50, 10
Element parameters can be a vector. The first code shows how setting and unsetting the vector instance name on the
element will created/remove the vector instances in layout:
ele.VectorInstanceName = ""
End Sub
Debug.Print title
Debug.Print "Element Name = " & ele.Name
Debug.Print "Element Vect Inst Name = " & ele.VectorInstanceName
Debug.Print "Element Vect Inst Count = " & ele.VectorInstanceCount
End Sub
The second example of code shows how changing the vector instance name multiple times and then performing move
commands between the changes is handled correctly during undo:
ele.Parameters("ID").ValueAsString = "TL1"
End Sub
See previous code for PrintDrawingObjectState ele, lay, "After Reset Vector Instance Name" subroutine
Each of the Element Parameters has a reference to an object called a ParameterDefinition. A ParameterDefinition is
associated with the model for the object and describes the attributes of the parameters that will be associated with elements
representing that model. So, each model includes an array of parameter definitions that act like templates for creating
the parameters associated with an Element representing the model. To get information about the type of the Parameter
object we need to look at the ParameterDefinition or template from which it was created. For example, let's create a script
that adds a schematic, MLIN element to that schematic, and then prints some information about the parameters for that
element.
Debug.Clear
Set schem = Project.Schematics.Add("MySchematic")
Set elem = schem.Elements.Add("MLIN", 0, 0)
End Sub
If you run this program you can get the following output:
While this is useful and provides values for the data type it would be nicer if we had some enumerations. In the object
browser we can see that the ParameterDefinition.DataType is a property of type mwParamDefDataType which has the
following definition:
enum mwParamDefDataType
{
mwPDDT_Real,
mwPDDT_Complex,
mwPDDT_Integer,
mwPDDT_String,
mwPDDT_ElementName,
mwPDDT_DataModel,
mwPDDT_InfoString,
mwPDDT_None,
mwPDDT_Enumeration,
mwPDDT_RealVector,
mwPDDT_FileName
} mwParamDefDataType;
If you place a . after the DataType property in the scripting environment, the Intellisense shows parameter definition
types as a list of the possible values. This is useful if you want to control flow based on a specific data type, like printing
only double values. If you want to print the data type you need to create a mapping function to map from the type value
to a string. A quick mapping function might look as follows:
Select Case id
Case mwPDDT_Real
ret = "mwPDDT_Real"
Case mwPDDT_Complex
ret = "mwPDDT_Complex"
Case mwPDDT_Integer
ret = "mwPDDT_Integer"
Case mwPDDT_String
ret = "mwPDDT_String"
Case mwPDDT_ElementName
ret = "mwPDDT_ElementName"
Case mwPDDT_DataModel
ret = "mwPDDT_DataModel"
Case mwPDDT_InfoString
ret = "mwPDDT_InfoString"
Case mwPDDT_None
ret = "mwPDDT_None"
Case mwPDDT_Enumeration
ret = "mwPDDT_Enumeration"
Case mwPDDT_RealVector
ret = "mwPDDT_RealVector"
Case mwPDDT_FileName
ret = "mwPDDT_FileName"
Case Default
ret = "Unkown"
End Select
ParameterDefTypeName = ret
End Function
And then you can use this in the main body of the code:
Debug.Clear
Set schem = Project.Schematics.Add("MySchematic")
Set elem = schem.Elements.Add("MLIN", 0, 0)
End Sub
So, the detailed type information about a parameter is available from the ParameterDefinition which acts as a template
to create the parameter when the Element is created and the parameter object includes a reference back to it's
ParameterDefinition object.
To filter hidden parameters out of the parameter list, use the following script:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Set schem = Project.Schematics("SCH1")
End Sub
Sub Main
Dim schem As Schematic
Dim elem As Element
Dim elemNode As Node
Debug.Clear
Set schem = Project.Schematics("SCH1")
End Sub
Next param
End Sub
The following code sets the SPICE model extraction level for an Element. Note that for the Element value to be different
than the Project value, you need to use elem.UseDefaultModelOptions = false so that the individual element is allowed
to be different:
Debug.Clear
Set elem = Project.Schematics("Schematic 1").Elements(1)
elem.UseDefaultModelOptions = False
elem.Options("SpiceModelLevel").Value = 2
End Sub
Option Explicit
Sub Main
Debug.Clear
Dim e As Element
Dim s As Schematic
Set s = Project.Schematics(1)
Dim i As Integer
For Each e In s.Elements
Debug.Print e.Name
For i = 1 To e.Properties.Count
Debug.Print e.Properties(i).Name & vbTab & e.Properties(i).Value
Next i
Next e
End Sub
PORT.P1
EM_Extract_Group EM_Extract
EM_Extract_Tool
PartNumber
PartHelpPath
XmlPath
PORT.P2
EM_Extract_Group EM_Extract
EM_Extract_Tool
PartNumber
PartHelpPath
XmlPath
PORT.P3
EM_Extract_Group EM_Extract
EM_Extract_Tool
PartNumber
PartHelpPath
XmlPath
PORT.P4
EM_Extract_Group EM_Extract
EM_Extract_Tool
PartNumber
PartHelpPath
XmlPath
API supports default value property for properties associated with a schematic element to the Property object. API
provides a read-only DefaultValue property that is populated with the default options for an element to provide access
to the original default value. For all properties if the default value is not available the current regular value is returned
as the default value. This can be used usually to check the simulator option values through EXTRACT block element
properties. If the value is non-default, we can reset it back to default via API. So we can add this to the code in previous
example:
API supports parameterized XML elements specified by data file elements that also include parameterized values. We
expand the types of files that can be used to specify the model and still include the possibility of parameterization. Make
the recursive add XML component call for additional model file data types as well.
The following script loops through properties and looks for the xmlPaths:
Debug.Clear
End Sub
To change the De-Embedding Method property for AXIEM Async, use the following code:
Project.Simulator.Analyze
Debug.Clear
End Sub
By enumerating the properties (Element.Properties), you can access useful properties such as EM_Extract_Group for
iNets. This is sort of confusing having Options, Parameters and Properties on an Element. The Parameters and Options
collections have a fixed set of entries which can be set or retrieved but the Properties collection has a slightly different
use model. The Properties collection provides a collection into which properties can be added. So, basically it's like the
Properties collection allows you to associate properties with specific names onto an element which others can look for
later to see if something has a specific property. What this means is that if an object doesn't have a specific property that
you want to set, what you need to do is add the property, it also takes a default value when you add it so you can set it
while adding it. If the object has the property and it not at the value you want then you can change it. For example, the
following code checks to see if the property "EM_Extract_Group" exists on the element. If this check returns False then
it adds the property and in this case it is the default "EM_Extract" , so, that it will be changed later and we can see that
it gets changed:
Debug.Clear
Project.Schematics(1).Elements(1).Options("ExtractModelType").Value = 1
End Sub
This script changes the value to "OK" on the first run, without the need to manually edit the value first. What happens
when you edit it and change it from the system default is that the property is created. Here in script we are doing the
same thing, we are creating the property.
You can also access the User Attributes property. See Adding User Attributes in XML Files for more information.
The following example shows API access to the first user attribute of Name=Cost, and Value=$20:
You can add a user attribute through the API. Note that you need to include "User:" in the command to add the user
attributes correctly. The following example adds a user attribute of Name=Person, Value=Ideen:
Set ele=Project.Schematics(1).Elements(1)
ele.Properties.Add("User:Person","Ideen")
ele.Properties.Remove("User:Person")
The following code example takes the partnumbers for each element and assigns them as user attributes for the same
part:
Else
ele.Properties.Add("User:Partnumber",ele.PartNumber)
End If
Next ele
Next sch
We have API access to User Attributes via the 'Properties' collection to Schematics, System diagrams, and EM structures
:
Project.EMStructures(1).Export("User_attr_test_Interdigital Filter")
Set ems = Project.EMStructures.Import(Project.Path + "User_attr_test_Interdigital Filter.EML")
Debug.Print "EMStructure Name = ";ems.Name
For Each prop In ems.Properties
If InStr(prop.Name,"EM Layer 2") Then
Select Case Replace(prop.Name,"User:","")
Case "EM Layer 2"
Debug.Print "EM Layer 2 = ";prop.Value
End Select
End If
Next prop
Project.Schematics(1).Export(Project.Path + "User_attr_test_sch",mwSEF_MWOSchematicFile)
Set sch = Project.Schematics.Import("User_attr_test_sch",Project.Path + "User_attr_test_sch.sch")
Debug.Print "Schematic Name = ";sch.Name
Next prop
Project.SystemDiagrams(1).Export(Project.Path + "User_attr_test_sys",mwSYF_MWOSystemFile)
Set sys = Project.SystemDiagrams.Import("User_attr_test_sys",Project.Path + "User_attr_test_sys.sy
Next prop
End Sub
The NI AWR SDE API allows you to reference a variable in an Element parameter by specifying the variable name as
its new value. After making this reference you need to define the variable by creating equations for the Schematic. See
Variables And Equations for more information.
Debug.Clear
Set schem = Project.Schematics("SCH1")
For Each eqn In schem.Equations
For i = 1 To eqn.NumSubexpressions
Debug.Print eqn.Subexpression(i)
Next i
Next eqn
API provides methods for obtaining equation expression values which are of type Real, String, and Array and located
in Schematic or Layout:
Sub Main
Dim schem As Schematic
Dim eqn As Equation
Dim expr As EquationExpression
Debug.Clear
Set schem = Project.Schematics("SCH1")
For Each eqn In schem.Equations
For Each expr In eqn.Expressions
PrintExpressionValue expr
Next expr
Next eqn
End Sub
Debug.Print expr.Expression
If (expr.DataType = mwEDT_Real) Then
Debug.Print "Real Value = " & expr.ValueAsDouble
End If
Debug.Print
End Sub
Subcircuit allows you to include a circuit block within a Schematic. The circuit block can be a Schematic (as in the
following example), a Netlist, a DataFile, or an EMStructure.
To import a DataFile for use as subcircuit in a Schematic, see Working with Data Files. Once added, the DataFile
displays in the Element Browser under the Subcircuits category. Only after this step can you place a Subcircuit into
Schematic. You have access to the Data File Options at the Document level. Changing values at this level requires you
to set "DataFile.UseProjectOptions" to "False".
Project.DataFiles("mdif_loc").Options("EnableInterpolation").Value=True
The Subcircuit collection is added to the Schematic for Subcircuits, Ports, NamedConnectors and Electrical Nets, and
to the Subsystems collections also for Subsystems and Ports.
Each Subcircuit has a NET parameter that names the Schematic that is the Subcircuit, although it might be a Data File
also. To access the Elements inside, you do not need to go through all of the Schematics. You can get the NET parameter
and use it as an index into the Schematics collection to get the Schematic, and then go through the Elements of the
Schematic. A Subcircuit is really just an Element that references another Schematic. The Element has a Parameters
collection; in that collection is a parameter named NET, the value of which is the name of a Schematic or Data File being
used as the Subcircuit. The Schematics collection can take a string name as the index, so you can go directly from the
value of the NET parameter to the Schematic the Subcircuit represents. This is the way the software works for simulation.
The NET parameter defines the Schematic to use to simulate the Subcircuit.
In addition, all the collections in the system now have methods that should help in quickly testing if a NET value is a
Data File, Schematic, or EM structure.
Option Explicit
' Code Module
Sub Main
Dim s As Schematic
Dim s_Top As Schematic
Dim y As Double
y = 0
Set s_Top = Project.Schematics("Test Schematics")
For Each s In Project.Schematics
If s.Name <> s_Top.Name Then
Debug.Print s.Name & " " & s.Elements.Count
s.Elements.Add("PORT",0,0)
s_Top.Elements.AddSubcircuit(s.Name,0,y)
y = y + 500
End If
Next s
End Sub
One more example of placing a Subcircuit in a Schematic using the AddSubcircuit() method. In the code we rotating
Subcirquit:
Debug.Clear
Set schem1 = Project.Schematics("SCH1")
Set elem = schem1.Elements("MLIN.TL3")
After placing the Subcircuit, you can edit the Subcircuit parameter values (you can edit any Schematic Element parameter
value and change the position of the parameter Frame).
I=0
Set CurrentSchm = Project.Schematics(schIndex)
For Each elem In CurrentSchm.Elements
If elem.Enabled = True Then
If Left(elem.Name,6) = "SUBCKT" Then
For Each par in elem.parameters
I = I + 1
y =elem.parameters(I).ValueAsString
Debug.Print y
Next par
End If
End If
Next elem
Sometimes when we add element to Subcircuit the element is added not in a position to connect to the nodes of the
subcircuit. The following example is the script that uses the element and gets the position of the node we want to hit
when adding the ground:
Here we are using the position of the element node to provide the coordinates for the placement of the GND element.
If you add a port to Schematic "a", which is included in Subcircuit "b", you must update the Subcircuit instances in
Schematic "b".
The following code adds a Port to Schematic "a" and then updates the Subcircuit instances in Schematic "b". Note that
you need to select the Subcircuit instances before invoking the command.
Dim s, sc As Schematic
Dim e As Element
Dim g As Graph
Set s = Project.Schematics("a")
Set s = Project.Schematics("b")
Set sc = Project.Schematics("b")
For some applications you might need to set a top level Schematic and then find all objects in all Schematics below it:
This works by recursively calling the same function, called "process_hierarchy" in this case. The script works by setting
a top level Schematic and then calling the function and passing the Schematic into the function. In the function, it looks
at all Elements. If they are a Subcircuit, it determines if the Subcircuit net refers to a Schematic (since it could be a
Netlist, S-parameter file, or EM structure, etc.). If it is a Schematic, the process hierarchy function is called again with
the new Schematic object.
This example of processing hierarchy uses the Schematic.Subcircuits collection to find all of the .SUBCKT Elements:
To print the parameter definition and get the flag determining whether the parameter affects Layout, use the following
script. Note that on the parameter of the Subcircuit it prints TRUE if the parameter affects the Layout:
Sub Main
Dim schem As Schematic
Sub Main
Dim schem As Schematic
Dim elem As Element
Dim param As Parameter
Dim def As ParameterDefinition
Debug.Clear
Set schem = Project.Schematics("top")
To get and set the AffectsLayout property using the Equation object, use the following script:
Sub Main
Dim schem As Schematic
Dim eqn As Equation
Debug.Clear
Set schem = Project.Schematics("sub")
For Each eqn In schem.Equations
Debug.Print "Variable Type = " & eqn.VariableType
Debug.Print "Affects Layout = " & eqn.AffectsLayout
If eqn.AffectsLayout Then
eqn.AffectsLayout = False
End If
Next eqn
End Sub
Sub Main
Debug.Clear
Dim schem As Schematic
Set schem = Project.Schematics.Add("Master")
schem.Elements.Add("Res",0,0,0)
schem.Elements.Add("Res",2000,0,0)
Dim w As WireSegment
Dim ww As WireSegment
Dim ntw As WireSegment
Set w = schem.Wires.Add(1000,0,1000,1000)
Set w = schem.Wires.Add(1000,1000,2000,1000)
Set w = schem.Wires.Add(2000,1000,2000,0)
Set ww = schem.Wires.Add(1000,0,1000,-1000)
Set ww= schem.Wires.Add(1000,-1000,3000,-1000)
Set ww = schem.Wires.Add(3000,-1000,3000,0)
schem.Wires.Cleanup
Debug.Print "Count = ";schem.Wires.Count
For Each w In schem.Wires
Debug.Print "x1 = ";w.x1;vbTab;"y1 = ";w.y1;vbTab;"x2 = ";w.x2;vbTab;
"y2 = "; w.y2
Next w
End Sub
Count = 6
x1 = 1000 y1 = 0 x2 = 1000 y2 = 1000
x1 = 1000 y1 = 1000 x2 = 2000 y2 = 1000
x1 = 2000 y1 = 1000 x2 = 2000 y2 = 0
x1 = 1000 y1 = 0 x2 = 1000 y2 = -1000
x1 = 1000 y1 = -1000 x2 = 3000 y2 = -1000
x1 = 3000 y1 = -1000 x2 = 3000 y2 = 0
Notice that when printing wires coordinates you just iterate through the Wire collection. At the end of the script is a line
"schem.Wires.Cleanup" method. The call to the Cleanup method should cause the wire to connect properly.
NOTE: Hierarchical updates are not the same through the user interface (UI) as they are in the API. The UI typically
has complete connections, whereas in the API you can enter the segment pieces until the connection is complete. The
benefit is that when a wire is added it is not clear that the connectivity is complete (there may be additional wires needed).
As a result, you need to add one additional line after all the wiring changes are complete:
sch.UpdateConnectivity
You do not need to clean up the wires because when added through the API they are added a segment at a time, so until
all segments are added there are dangling segments. The API uses a method on the wires collection to trigger a recondition
call that cleans-up the wires:
wiresBefore = schem.Wires.Count
wiresAfter = schem.Wires.Count
wiresAfterClean = schem.Wires.Count
API supports WireSegments() collection of objects. NI AWR SDE provides Delete() method on the wire segment, which
can be called on a wire segment to delete it. NI AWR SDE also provides a Remove(Index) type call on the Wires
collection, which can be used to remove a segment from the collection by index, and methods for the x and y coordinates
of wire segment ends in the schematic api. We had methods for getting and setting the values, which can be used to move
the location of a wire endd:
Next wireSeg
You can print out the connection counts for the ends of wire segments in a case to see if segments are connected:
If node coordinates are unknown in advance, you need to obtain them from the Elements of the Schematic. Before getting
the node numbers from the Elements you must call SetupConnectivity.
SetupConnectivity ensures that the connectivity for the Elements of a Schematic is set up and consistent; this is, the node
numbers are set. In Netlist terms this means that all of the Elements connected to a given node have the same node
number.
The same is true for NI AWR SDE Schematics; all the Element nodes that are wired together have the same node number.
The call to SetupConnectivity causes this numbering to occur and establishes the node numbers for the Element nodes.
Getting the node numbers from the Schematic Elements is helpful when translating a Schematic into a netlist.
Ideally, you want the system to know when you make a call that requires the connectivity to be set up and just do it for
you, however this means that for each call to get the information off of each node, the system needs to check that the
connectivity is set up. For efficiency, the system provides a way for you to do so at the beginning.
The following example is a script that goes through the Schematics and the Schematic Elements and the nodes, and
outputs the information for each node. When it gets the Schematic from the Project, the first thing it does is call to set
up the connectivity. It is difficult to see, but when it runs on a Schematic all the Elements nodes connected together have
the same node number.
The following script uses basic functionality for accessing the elements of the nodes collection on the wire segments of
a schematic. The script reads the property values for each node on each wire segment of a schematic with multiple wire
nets and outputs the values:
Debug.Print "Nodes for Wire Segment From {x = " & ws.x1 & ", y = " & ws.y1 & "} to { x = " & ws.x2
index = 1
For Each nd In ws.Nodes
Debug.Print "Node[" & index & "]:"
Debug.Print "Connected = " & nd.Connected
Debug.Print "NodeNumber = " & nd.NodeNumber
Debug.Print "PortNumber = " & nd.PortNumber
Debug.Print "Type = " & nd.Type
Debug.Print "x = " & nd.x
Debug.Print "y = " & nd.y
index = index + 1
Next nd
Debug.Print ""
Type = 0
x = -500
y = -100
Node[2]:
Connected = True
NodeNumber = 1
PortNumber = 0
Type = 0
x = -500
y = 900
To work with the ElectricalNets collection of objects and print all property values for the ElectricalNet parameters to
the Debug window, use the following script:
Implementations for the Add() and RemoveAll methods in the WireNet, Wires collection.
These methods allow you to remove all the wire segments associated with a wire net. We have problems if we allow the
segments to be deleted one by one as the wire cleanup code gets out of sync with what the API is doing but if we do a
whole wire net at a time it works fine as we can remove all the segments in the net before trying to clean up the connectivity.
The wirenet is the parent for all wire segments within a single connection, this allows the removal of all the wire segments
associated with a single connection node with something like the following:
End Sub
The following code locates a specific wire net by the node position of a segment. Gets the parent net for the segment
and then removes all the wires in that wire net. The code includes some additional wires in different nets and the count
change is check to ensure that we just removed the wires associated with the wire net and not all wires:
bFound = False
For Each wireSeg In schem.Wires
If (wireSeg.x1 = -500 And wireSeg.y1 = -100) Then
Set targetSeg = wireSeg
bFound = True
End If
Next wireSeg
wiresBefore = schem.Wires.Count
wiresAfter = schem.Wires.Count
The following code verifies that adding a wire to the wires collection associated with a particular wire net works correctly:
wiresBefore = schem.Wires.Count
wiresAfter = schem.Wires.Count
We added a support for controlling net highlight through the wire net objects associated with a schematic. This makes
it easier to highlight the wires associated with a particular node of an element on the schematic side. The highlight also
pertains to the physical net and so highlights objects associated with the physical net in layout.
The first example shows how to highlight cross probing between wire nets and associated physical nets:
phys.HighlightNet(True, mwCLR_Azure)
PrintHighlightState schem, "Highlight On"
phys.HighlightNet(False)
PrintHighlightState schem, "Highlight Off
End Sub
Debug.PrintTitle
Debug.Print"Wire Count = " & schem.Wires.Count
For Each ws In schem.Wires
Debug.Print"Wire Highlight = " & ws.ParentNet.NetHighlight;
If (ws.ParentNet.NetHighlight) Then
Debug.Print", Color = " & ws.ParentNet.NetHighlightColor
Else
Debug.Print""
End If
Next ws
If (phys.NetHighlight) Then
Debug.Print ", Color = " & phys.NetHighlightColor
Else
Debug.Print""
End If
Next phys
Debug.Print""
End Sub
The following code shows how to use InvokeCommand() to highlight on to certain color and highlight off:
PrintHighlightState lay
lay.PhysicalNets("ELENET2.EN1").Routes(1).Selected = True
' Turn on highlight (initially color red).
lay.InvokeCommand("NetHighlightOn", Array(255))
PrintHighlightState lay
PrintHighlightState lay
lay.InvokeCommand("NetHighlightOff")
PrintHighlightState lay
The following code shows the schematic side commands for highlighting nets based on selected wire segments:
x = elem.Nodes(2).x
y = elem.Nodes(2).y
Debug.Print Title
Debug.Print "Wire Count = " & schem.Wires.Count
For Each ws In schem.Wires
Debug.Print "Wire Highlight = " & ws.ParentNet.NetHighlight;
If (ws.ParentNet.NetHighlight) Then
Debug.Print ", Color = " & ws.ParentNet.NetHighlightColor
Else
Debug.Print ""
End If
Next ws
End Sub
The following code shows another way to highlight wires using properties:
wn.HighlightNet(True, mwCLR_Azure)
wn.HighlightNet(False)
End Sub
Debug.Print Title
Debug.Print "Wire Count = " & schem.Wires.Count
For Each ws In schem.Wires
Debug.Print "Wire Highlight = " & ws.ParentNet.NetHighlight;
If (ws.ParentNet.NetHighlight) Then
Debug.Print ", Color = " & ws.ParentNet.NetHighlightColor
Else
Debug.Print ""
End If
Next ws
End Sub
The following code shows how to use InvokeCommand() to highlight wires on schematic
Dim wn As WireNet
If (schem.Windows.Count = 0) Then
schem.NewWindow(mwWT_Schematic)
End If
schem.Activate
schem.SelectedWires.RemoveAll
schem.SelectedWires.Add(schem.Wires(1))
schem.InvokeCommand("NetHighlightOn", Array(255))
schem.InvokeCommand("EditUndo")
schem.InvokeCommand("EditRedo")
End Sub
Debug.Print Title
Debug.Print "Wire Count = " & schem.Wires.Count
For Each ws In schem.Wires
Debug.Print "Wire Highlight = " & ws.ParentNet.NetHighlight;
If (ws.ParentNet.NetHighlight) Then
Debug.Print ", Color = " & ws.ParentNet.NetHighlightColor
Else
Debug.Print ""
End If
Next ws
End Sub
The following code shows one more example how to use InvokeCommand() to highlight wires on schematic
schem.SelectedWires.RemoveAll
schem.SelectedWires.AddAll
schem.InvokeCommand("NetHighlightOn", Array(255))
schem.InvokeCommand("NetHighlightAllOff")
schem.InvokeCommand("EditUndo")
schem.InvokeCommand("EditRedo")
End Sub
The following code shows how to use InvokeCommand() to highlight color for wires on schematic. The command to be
invoked with a color values for the selected wires in the schematic:
If (schem.Windows.Count = 0) Then
schem.NewWindow(mwWT_Schematic)
End If
schem.Activate
schem.SelectedWires.RemoveAll
schem.SelectedWires.Add(schem.Wires(1))
schem.InvokeCommand("NetHighlightOn", Array(255))
schem.InvokeCommand("NetHighlightColor", Array(mwCLR_Green))
schem.InvokeCommand("EditUndo")
schem.InvokeCommand("EditRedo")
End Sub
The following code works with the ElementsPorts collection and prints all port parameter properties to the Debug window:
A Named Connector is an Element that provides connectivity by name, so any two or more Named Connectors in a
Schematic with the same name form a connection. For example, in the following script two Named Connectors are added
to the nodes of the Elements you want to connect. To ensure correct connection, the named connectors are given a name
that is unique in the Schematic, but matches between the two so they are connected together by having the same name:
A named connector is useful when you need to make a large number of connections at different locations within a
Schematic to a single pin or port, such as with a power or clock signal line. The following script works with the
NamedConnectors collection and prints the NamedConnector properties to the Debug window:
Next en
Debug.Print
Next sch
Set en = Project.Schematics(1).NamedConnectors(1)
'
For Each nd In en.Nodes
Debug.Print " NodeNumber = ";nd.NodeNumber;vbTab;"nd.PortNumber = ";nd.PortNumber;vbTab;nd.x;vbTa
Next nd
'
For Each op In en.Options
Debug.Print op.Name;vbTab;op.Description;vbTab;op.Value;vbTab;op.DataType;vbTab;op.DefaultValue
Next op
End Sub
The following example script prints information for the Named Connectors collection of objects:
For n = 1 To Sch.NamedConnectors.Count
Debug.Print Sch.NamedConnectors(n).Name
For Each par In Sch.NamedConnectors(n).Parameters
Debug.Print par.Name;vbTab;vbTab;par.ValueAsString;vbTab;par.ValueAsDouble
Next par
Next n
End Sub
We can add different shapes collection to schematic design documents. The following code shows how to add different
shapes correctly to the schematic document's drawing shapes collection, how to remove and delete shapes, and how the
attributes of shapes can be enumerated:
pts(0) = 0
pts(1) = 0
pts(2) = 500
pts(3) = 500
Moving Shapes
For Each objShape In schem.DrawingShapes
objShape.Move(500, 500)
Next objShape
count = schem.DrawingShapes.Count
If count >= 2 Then
schem.DrawingShapes.Remove(2)
End If
Deleting Shapes
For Each objShape In schem.DrawingShapes
objShape.Delete
Next objShape
End Sub
Debug.Print title
Debug.Print "Drawing Shape Count = " & schem.DrawingShapes.Count
For Each dwShape In schem.DrawingShapes
Debug.Print "Shape Type = " & dwShape.Type
Debug.Print "Shape Type Bits = " & dwShape.TypeBits
Debug.Print "Shape Base Pos = " & " { x = " & dwShape.BasePosition.x & ", y = " & dwShape.B
Debug.Print "Shape Flipped = " & dwShape.Flipped
Debug.Print "Shape Rotation Ang = " & dwShape.RotationAngle
Debug.Print "Shape Point Count = " & dwShape.Points.Count
index = 1
For Each shpPoint In dwShape.Points
Debug.Print " Point[ " & index & " ] = { x = " & shpPoint.x & ", y = " & shpPoint.y & " } "
index = index + 1
Next shpPoint
Debug.Print ""
End Sub
In this script, constant mwWT_Schematic determines the Window type for the Schematic.
Filter:1
End Sub
After running the script we can have output like the following:
For i = 1 To schem.EmbeddedDesigns.Count
If (schem.EmbeddedDesigns(i).DesignName = "SCH1") Then
index = i
End If
Next i
Performing Simulations
In addition to working with Schematics, you can perform simulation through the API. To start a simulation, use the
following code:
Project.Simulator.Analyze
Note that the statement after Project.Simulator.Analyze works only after the simulation is complete.
This script iterates through the Netlists collection and prints out Netlist properties:
The following are constants that define different types of Netlists that you can import into an NI AWRDE Project:
We have SimulationDirty and SimulationState properties for datafiles and netlists in the API.
Project.Netlists(2).NewWindow
Printing a Netlist
You can print the contents of a Netlist using the PrintOut method. You can also print DataAsText to the Immediate
Window, and you can determine the Name and FileName of the Netlist.
Dim em As EMStructure
For Each em In Project.EMStructures
Debug.Print "EMStructure Name : ";em.Name
Next em
After you have a reference to an EMStructure, you can access the Frequencies and Options Collection for the particular
EMStructure. You can also access the EMStructure Enclosure object, and the Shapes and MaterialLayers collections.
You can use the Project global settings for the EMStructure.
To loop through the whole collection of the EMStructures Options, use the following code:
Option ValueTrue
Option Name ComputeLoadedCurrents
Option Data Type 11
Option Default Value True
Option Description Returns/sets if loaded currents should be computed.
Option ValueTrue
Option Name UseSameSizeBox
Option Data Type 11
Option Default Value False
Option Description Returns/sets if the same size box should be used for de-embeded circuit.
Option ValueFalse
Option Name SaveResultsInDocument
Option Data Type 11
Option Default Value False
Option Description Returns/sets if the results should be saved in the EM document.
Option ValueFalse
Option Name MaxDifferentialOrder
Option Data Type 3
Option Default Value 12
Option Description Returns/sets the maximum differential order computed.
Option Value12
Option Name MatrixSolverType
Option Data Type 3
Option Default Value 0
Option Description Returns/sets the matrix solver type used for analysis.
Option Value0
The following script shows how to deal with EM Options that are array:
Debug.Clear
'Collect up EM options and values. Save in dictionary. Can't use option name as key since there
For i = 1 To Project.EMStructures.Options.Count
If IsArray(opt.Value)=True Then
'If option is an array, must convert it to string
ReDim optarray(UBound(opt.Value))
For n = 0 To UBound(opt.Value)
optarray(n) = opt.Value(n)
Next n
optstg = Join(optarray)
dict.Add(i,optstg)
Else
'Add option value to dictionary
dict.Add(i,opt.Value)
End If
Next i
For i = 1 To Project.EMStructures.Options.Count
Set opt = Project.EMStructures.Options(i)
Debug.Print opt.Name & vbTab & dict(i)
Next i
Debug.Print Project.EMStructures.Options("AWR_JobSchedulerMaxProcs").Value
You can configure particular settings. To change the default options set the Use Project Options property to "False".
To loop through the EMStructure "EMStructure 1" Options, use the following code:
The following is a simple example of changing an option value. Note that "ems.UseProjectOptions = False" is done
before the value is changed:
em.Options.Count = 35
Option : 1 Name AnimateUseLogColorScale Value = True DataType = 11 DefaultValue = True
Description = Returns/sets if a color log scale should be used for animation.
Option : 2 Name AnimateActiveCurrentLayer Value = True DataType = 11 DefaultValue = True
Description = Returns/sets if only currents on the active layer should be animated.
Option : 3 Name AnimateActive2DLayerOnly Value = False DataType = 11 DefaultValue = False
The following is a simple example of accessing an option via name of the option:
Next iOpt
To check the "Deembed port/feed line" option, use the following code:
You also can set the Value and DefaultValue for the Option getting the Option by name or by index.
By default, EM simulations occur at the Project frequencies. You also can set your own Frequencies for simulation of a
particular EMStructure by setting "Use Project Frequency" to False and specifying the desired frequencies.
This example also shows how to remove a frequency from the Project.
Note that because the EM document uses project defaults it returns 3 freqs when you query it. If you set Use Project
Frequencies = False it returns 4 freqs when you query it because the EM document has its own 4 freqs, while the project
has 3 freqs.
We add support for Locking EM Structure objects in the API using methods similar to what is available in the Schematic
and System Diagram objects.
The following script shows how to access the lock level property:
Debug.Clear
Set ems = Project.EMStructures("EMS1")
Debug.Print "Name = " & ems.Name
Debug.Print "Lock Level = " & ems.LockLevel
Debug.Print "Lock Edit = " & ems.LockDiagram(mwDLL_LockedForEdit, "test")
Debug.Print "Lock Level = " & ems.LockLevel
Debug.Print "Unlock Edit = " & ems.LockDiagram(mwDLL_Unlocked, "test")
Debug.Print "Lock Level = " & ems.LockLevel
End Sub
Modifying Settings for EMSight and AXIEM tabs for EMStructure Options
enum mwEmSimulator {
mwEMS_AwrAxiem,
mwEMS_AwrAxiem32,
mwEMS_AwrAxiem64,
mwEMS_AwrEmSight,
mwEMS_AwrAnalyst,
mwEMS_AwrAce,
mwEMS_SonnetEm,
mwEMS_ZelandIe3d,
mwEMS_OeaNetan,
//mwEMS_HelicVelocerf,
} mwEmSimulator;
You can access solver level options at the Project level. This allows access to options for specific EM solvers from the
EMStructures.Options collection to set the default "project level" options for different solvers. You can also save changes
to a specific structure's solver options when you access the options through an EMStructure. To see these structure-specific
changes, you must turn off UseProjectDefaults at the structure level or the Project level defaults are returned instead.
The following shows which options you can access from specific tabs:
AXIEM, OEA, and ACE options are identifiable in the following output:
Option Name = ACE:Show Simplified Stackup Option Description = ACE:Show Simplified Stackup Value =
The solver options used for EMSight and AXIEM include options for Advanced Frequency Sweep (AFS). The API
options for the solver set include the AFS options as well as the standard solver options. The following enables/disables
the AFS. You can also access the other AFS group options.
Debug.Clear
Set em = Project.EMStructures(1)
Set o = get_axiem_option_by_ID(em,20095)
Debug.Print o.Value
o.Value=.2
End Sub
Function get_axiem_option_by_ID(em As EMStructure, id As Integer) As Option
Dim o As Option
The script sets the absolute size for the edge mesh.
The following are additional example scripts for changing AXIEM options:
Dim em As EMStructure
Project.Simulator.Analyze
Set em = Project.EMStructures("Stand_Alone")
Debug.Clear
Debug.Print "Edge Mesh Before Change: "; em.Options("eAX_meshEdgeMeshing").Value
Debug.Print "Decimation Before Change: "; em.Options("eAX_MESH_DECIMATION_OPTIONS").Value
em.Options("eAX_meshEdgeMeshing") = True
em.Options("eAX_MESH_DECIMATION_OPTIONS") = 0
Debug.Clear
Set emStruct = Project.EMStructures("EM Structure 1")
Debug.Print emStruct.Options("AFSEnable").Value
emStruct.UseProjectOptions = False
emStruct.Options("AFSEnable").Value = True
Debug.Print emStruct.Options("AFSEnable").Value
End Sub
Other AFS options (for example, the AFS band, and error type and tolerance) should display as "AFS...".
To create an EMStructure with Default method you need to use the Add command, which takes one argument (the name
of the EMStructure you want to add). For example, to create a new EMStructure with the name "MyEMStructure", enter:
Project.EMStructures.Add("MyEMStructure")
This function does not overwrite an existing EMStructure. If an EMStructure named "MyEMStructure" already exists,
the new EMStructure is named "MyEMStructure 1".
Dim em As EMStructure
Set em = Project.EMStructures.Add("MyEMStructure")
Project.EMStructures.AddEx("New",mwEMS_AwrAnalyst)
The following are constants that define the different types of electromagnetic simulators:
mwEMS_AwrAxiem 0
mwEMS_AwrAxiem32 1
mwEMS_AwrAxiem64 2
mwEMS_AwrEmSight 3
mwEMS_AwrAnalyst 4
mwEMS_AwrAce 5
mwEMS_SonnetEm 6
mwEMS_ZelandIe3d 7
mwEMS_OeaNetan 8
mwEMS_CST 9
mwEMS_HFSSAsync 10
mwEMS_CSTAsync 11
mwEMS_SonnetAsync 12
Note that there are different constants when a new EM document is created through the API with AXIEM specified as
the simulator.
To create EM Structure with Initialization Options we use two steps. The first step is using the method
EMStructures.CreateInitRecord() that creats an instance of an EMInitRecord and returns it to the user. This can be filled
out and then passed to a second method AddInit() which will create an EmStructure and then use the information inside
the Initialization record to perform the requested initialization.
The following is the example of code that creats EM Structure initialized from STACKUP element:
The following is the example of code that creats EM Structure initialized from LPF:
Project.EMStructures.Remove ("MyEMStructure")
Project.EMStructures.Import("MyEMStructure.eml")
Note that the MyEMStructure file has an *.eml extension. This code adds EMStructure to the collection from a file and
returns the reference to the created EMStructure. This means that on creating a new EMStructure, the Project Browser
displays the imported EMStructure and its subnodes under the EM Structures node.
If you want to access an EMStructure without copying it into the Project you can link to an EMStructure. To link to an
EMStructure, use the following code:
Project.EMStructures.LinkTo("MyEMStructure.eml")
When you link to an EMStructure the file must always be available for the Project to read.
Drawing EMStructures
Working with an Enclosure
The API exposes the Enclosure object to work with the EMStructure. The Enclosure object specifies boundary conditions
and dielectric materials for each layer of the EMStructure.
References to boundary conditions mean the BoundaryModel that is associated with the EMStructure Enclosure, and
exists only at the top and bottom of an EMStructure. It provides access to a Type enumeration for the Boundary Type.
The following are constants that define different types of boundary models:
Name
Value
mwBMT_PerfectConductor
0
mwBMT_SpecifiedMaterial
1
mwBMT_ApproximateOpen
2
mwBMT_InfiniteWaveguide
You cannot set the Boundary Type; you can only print the Type using the API.
Debug.Print enc.EnclosureTop.Type;vbTab;enc.EnclosureBottom.Type
The Enclosure properties describe the dimensions and resolution of the rectangular enclosure.
You can modify the Enclosure xDimension, yDimension, xDivisions, and yDivisions. Note that setting the number of
divisions in the X and Y direction specifies the grid. To output the Height, XCellSize, and YCellSize of the Enclosure
object, use the following script:
Sub Main
Dim emStruct As emStructure
Debug.Clear
For Each emStruct In Project.EMStructures
Debug.Print "Em Structure Name = " & emStruct.Name
PrintEnclosureInfo(emStruct.Enclosure)
Next emStruct
End Sub
Sub PrintEnclosureInfo(ByRef encl As Enclosure)
Debug.Print
Debug.Print "Enclosure Info:"
Debug.Print " - Enclosure Height = " & encl.Height * 1e6 & " um"
Debug.Print " - Enclosure XDimension = " & encl.XDimension * 1e6 & " um"
Debug.Print " - Enclosure YDimension = " & encl.YDimension * 1e6 & " um"
Debug.Print " - Enclosure XDivisions = " & encl.XDivisions
Debug.Print " - Enclosure YDivisions = " & encl.YDivisions
Debug.Print " - Enclosure XCellSize = " & encl.XCellSize * 1e6 & " um"
Debug.Print " - Enclosure YCellSize = " & encl.YCellSize * 1e6 & " um"
Debug.Print
Debug.Print "Top: - ";
PrintBoundaryModel(encl.EnclosureTop)
Debug.Print "Bottom: - ";
PrintBoundaryModel(encl.EnclosureBottom)
Sub PrintBoundaryModel(ByRef bm As BoundaryModel)
Debug.Print "Boundary Model"
Debug.Print " - Type = " & BoundaryModelTypeToString(bm.Type)
Debug.Print
End Sub
Function BoundaryModelTypeToString(bmType As Integer) As String
Dim ret As String
Select Case bmType
Case mwBMT_PerfectConductor
ret = "mwBMT_PerfectConductor"
Case mwBMT_SpecifiedMaterial
ret = "mwBMT_SpecifiedMaterial"
Case mwBMT_ApproximateOpen
ret = "mwBMT_ApproximateOpen"
Case mwBMT_InfiniteWaveguide
ret = "mwBMT_InfiniteWaveguide"
Case Else
ret = "Unknown"
End Select
BoundaryModelTypeToString = ret
End Function
Enclosure Info:
- Enclosure XDivisions = 80
- Enclosure YDivisions = 80
- Enclosure XCellSize = 10 um
- Enclosure YCellSize = 10 um
- Type = mwBMT_PerfectConductor
- Type = mwBMT_PerfectConductor
MyEMStructure1
Material.Name = =Perfect Conductor
Material.Color = 32896
Material.Thickness = 0
True
ExcessSurfaceReactance = 0
HighFrequencyLoss = 0
LowFrequencyLoss = 0
Conductivity = 0
Note that you have access only to the Material of the Enclosure Top and Enclosure Bottom and both Materials are
ReadOnly properties.
To copy a Schematic Layout to an EM structure you need to set the Enclosure first.
The following is a workaround using an NI AWR SDE script that copies the Schematic Layout to the Clipboard and
pastes it to the EMStructure.
After you have an EMStructure, you can access all of the MaterialLayers in the EMStructure and access all MaterialLayer
properties. You can also add a new MaterialLayer. After accessing the properties you can change the Dielectric Constant,
Loss Tangent, Thickness, and Bulk Conductivity. The following script demonstrates these capabilities:
Access to the MaterialLayers collection allows you to get and to change hatch patterns used for conductors placed on a
layer, as shown in the following script:
Em Structure = MyEMStructure1
Material Hatch = mwHS_DiagonalCross
Material Via Hatch = mwHS_Cross
Material Hatch = mwHS_Horizontal
Material Via Hatch = mwHS_Vertical
Material Hatch = mwHS_ForwardDiagonal
Material Via Hatch = mwHS_BackwardDiagonal
Em Structure = EM S
Material Hatch = mwHS_DiagonalCross
Material Via Hatch = mwHS_Cross
Material Hatch = mwHS_Horizontal
Material Via Hatch = mwHS_Vertical
Material Hatch = mwHS_Cross
Material Via Hatch = mwHS_DiagonalCross
To modify the ViewScale factor that scales the thickness of the layers, use the following script:
Em Structure = MyEMStructure1
OldViewScale = 1
NewViewScale = 10
OldViewScale = 1
NewViewScale = 10
OldViewScale = 1
NewViewScale = 10
Em Structure = EM S
OldViewScale = 1
NewViewScale = 10
OldViewScale = 1
NewViewScale = 10
OldViewScale = 5
NewViewScale = 10
OldViewScale = 1
NewViewScale = 10
You can draw Shapes in an EMStructure. Arguments to the Add Shape functions take drawing layer names directly to
the Layout Editor instead of the EM Editor.
The EMStructure object has a collection of Shapes that you can add with the Layout Editor. You can draw conductors,
vias, via-ports, and edge-ports.
When Shapes are added by the function they are added onto the Layer for which the Name is distinctively defined in
code.
The function that adds Shapes has a string argument called layerName. This argument is interpreted as the layer Name
on which the shape is to be added (For example, "Thick Metal").
When you draw edge ports they must be associated with a conductor, so when using the AddPort or AddFace methods
you must draw the conductor first, and the points of the face must match the conductor points for the side to which it is
associated.
To add a Via object to the EMStructure, you can draw a via using the regular Draw commands, and specify a layer that
has its mapping set up for a via. To add a ViaPort object, you can use the AddFace methods and match the points of the
face to the via points for the side with which it is associated.
' Must draw conductor first and points must match conductor points
objStruct.Shapes.AddFace(0, 100e-6, 0, 200e-6)
End Sub
Case Else
sName = "mwST_Unknown"
End Select
' Return the shape type name.
ShapeIDToName = sName
End Function
Em Structure = MyEMStructure1
Shape Count = 6
**** Shapes ****
mwST_Polygon
mwST_Polygon
mwST_Polygon
mwST_Polygon
mwST_Polygon
mwST_Polygon
Em Structure = EM2lines
Shape Count = 4
**** Shapes ****
mwST_Polygon
mwST_Polygon
mwST_Polygon
mwST_Polygon
To access the Boolean command Simplify Shapes for EM Structure Shapes use InvokeCommand() method. The name
for this command is not quite what you'd expect from the external name. The command which is exposed to the user as
"Simplify Shapes..." is internally "ProcessEmShapes". This is because it calls the Shape Preprocessor to process the
shapes of an EM design. Since this command is a single shot command (meaning it doesn't need arguments) we can
invoke it using the internal name "ProcessEmShapes":
em.InvokeCommand("ProcessEmShapes")
End Sub
The script would invoke the "Simplify Shapes..." command on the shapes in "EM Structure 1".
You can access the Shapes Attributes and Vertex collections with the following script:
Em Structure = EM2lines
Shape Count = 4
**** Shapes ****
LayerIndex
0 -0.00000946
0 -0.00000954
0.00001 -0.00000954
0.00001 -0.00000946
LayerIndex
0.000009608 -0.000009496
0.00001 -0.000009496
0.00001 -0.000009504
0.000009608 -0.000009504
LayerIndex
0.000009608 -0.000009492
0.000009608 -0.000009508
0.0000096 -0.0000095
LayerIndex
0.00001 -0.000009484
0.000010032 -0.000009484
0.000010032 -0.000009516
0.00001 -0.000009516
Each Shape is associated with Boundary Top, Bottom, Left, and Right properties:
The API provides access to the EMStructure.Info values for Solve Time/Frequency, Total Solve Time, Memory
Requirement, Physical Memory, and MeshSize. The scope of these settings is the structure as whole.
Em Structure = EM2lines
CacheSize = 12800000 MemoryRequirement = 148864
MeshSize = 68 PhysicalMemory = 267698176
TimePerFrequency = 5.0430303948619 TotalTime = 10.0860607897238
The API provides access to the EXTRACT Element Properties. To view the Properties, use the following script:
Sub Main
Debug.Clear
Dim e As Element
Dim s As Schematic
Set s = Project.Schematics(1)
Set e = s.Elements("EXTRACT.EX1")
Dim i As Integer
For i = 1 To e.Properties.Count
Debug.Print e.Properties(i).Name & vbTab & e.Properties(i).Value
Next i
'e.Properties("AXIEM:Greens Function Accuracy").Value = 1
'e.Properties("AXIEM:Basis Integration Accuracy").Value = 5
'e.Properties("AXIEM:Moment Integration Method").Value = 0
End Sub
AXIEM:ACA_REPORT 0
AXIEM:ACA_TOL 1.000000e-008
AXIEM:ACA_TOL_ZV_ZS_RATIO 2.000000e+001
AXIEM:AFS_MAX_PTS 40
AXIEM:AFS_TOL -3.000000e+001
AXIEM:Analytical Integration Singular Part of Greens Function 1
AXIEM:Basis Integration Accuracy 0
AXIEM:CACHED_ASSEMBLER 4224
AXIEM:CACHE_THRESHOLD_MULT 8.000000e+000
AXIEM:CBF_MAX_DIA_GRP 1.000000e-003
AXIEM:CBF_MAX_ELEM_GRP 50
AXIEM:COMPRESS_LOG 0
AXIEM:CONDUCTIVE_PEC 1.000000e-006
AXIEM:COND_NUM 0
AXIEM:ClusterTree_maxNumElem 40
AXIEM:ClusterTree_minNumElem 5
AXIEM:DCIM SImage Loc Threshold 1.000000e-005
AXIEM:DCIM SImage Mag Threshold 1.000000e-003
AXIEM:DCIM T1 3.000000e+000
AXIEM:DCIM T2 1.000000e+002
AXIEM:DCIM_AutoStep1_Threshold 1.000000e-005
AXIEM:DROP_TOL 1.000000e-003
AXIEM:FILL_IN 1.000000e+002
AXIEM:FILL_IN_A 100
AXIEM:GMRES_TOL 1.000000e-007
AXIEM:GRNS_FNCT_DIAG 79
AXIEM:GRN_FNCT_PREC 2
AXIEM:Greens Function Accuracy 1
AXIEM:Greens Function Method 1
AXIEM:H_ETA_ZV_ZS_RATIO 1.000000e+000
AXIEM:H_MATRIX_DIAG 22
AXIEM:H_MAX_ELE_ZV_ZS_RATIO 1.000000e+000
AXIEM:H_Matrix_Eta 4.000000e+000
AXIEM:ILU_TOL 1.000000e-003
AXIEM:Include Scalar Potential Components 1
AXIEM:Include Static Image Components 1
AXIEM:Include Vector Potential Components 1
AXIEM:LOOP_TREE_SCALE_FACT 3.000000e+003
AXIEM:LT_ACA_RATIO 1.000000e+003
AXIEM:LT_MOM_ACC_RATIO 5.000000e-001
AXIEM:LowFSolverGauge 1.000000e-003
AXIEM:MAX_ITER 2000
AXIEM:MAX_NZ_ROW_A 200
AXIEM:MAX_NZ_ROW_R 1.000000e+002
AXIEM:MESH_BASIS_TYPES 511
AXIEM:MESH_DIAG 48742527
AXIEM:MESH_MIN_EDGE_RATIO 1.000000e+000
AXIEM:MESH_RATIO 1.000000e+001
AXIEM:MTX_CALC_DIAG 96
AXIEM:MTX_CALC_SOLVE_TYPE 3
AXIEM:MTX_COMPRESSION_DIAG 133184
AXIEM:Matrix Assembly Mode 1
AXIEM:Moment Integration Method 2
AXIEM:Number GPOF Samples 120
AXIEM:OCT_TREE_MAX_LEV 20
AXIEM:OPTIONS_TO_LOG 0
AXIEM:PC_TOL_REDUCE 1.000000e+003
AXIEM:PRECOND_DIAG 4100
AXIEM:PREC_GEN_E_PER_ROW 160
AXIEM:PRINT_MATRIX 0
AXIEM:Point Match Weighting Method 0
AXIEM:RANK_LOG 0
AXIEM:RCP_MAX_DIA_GRP 1.000000e-003
AXIEM:RCP_MAX_ELEM_GRP 50
AXIEM:REORDER 0
AXIEM:SUBSPACE_SIZE 400
AXIEM:SVD Absolute Limit 1.000000e-008
AXIEM:SVD Threshold 1.000000e-006
AXIEM:SVD_REL_TO_ACA 1.000000e+001
AXIEM:SVD_REPORT 0
AXIEM:Surface Wave Extraction 0
AXIEM:USE_CROSS_TERMS 0
AXIEM:USE_DIRECT_BELOW 2000
AXIEM:Use EMSight Mesher 0
AXIEM:VERT_MESH_LAYERS 1
AXIEM:eACAPivotStrategy 1
AXIEM:eAxiemExtendTo0Flag 0
AXIEM:eAxiem_AFS_Options 6
AXIEM:eDeEmbeddingMethod 1
Bus_VectorInst_Name
EMSight:AFSdBDiff -4.000000e+001
EMSight:AFSnComparePts 200
EMSight:BandStart 1.500000e+010
EMSight:BandStop 1.500000e+010
EMSight:MaxSimPts 200
EMSight:SpecifyBand 0
EMSight:UseAFS 0
EMSight:UseRelErrorAFS 0
EMSight:deembed 1
EMSight:diffOrder 12
EMSight:fastFreqSweep 0
EMSight:iter_tolerance 1
EMSight:loadCurrents 1
EMSight:relError 0
EMSight:sameSizeBox 0
EMSight:saveCurInDoc 0
EMSight:singlePrec 0
EMSight:solveType 0
EMSight:tolerance 1
EMSocketOptions:errTol -4.000000e+001
EMSocketOptions:errorType 1
EMSocketOptions:numGridPoints 500
EMSocketOptions:saveAntenna 0
EMSocketOptions:saveCurrents 0
EMSocketOptions:saveFields 0
EMSocketOptions:useAdvFreqSweep 0
EMSocketOptions:useNativeEditor 0
EM_Extract_Group EM_Extract
EM_Extract_Tool
FreqOptions:1 1.500000e+010
FreqOptions:UseDefault 0
FreqOptions:nFreqs 1
InterPOptions:ForcePassive 0
InterPOptions:UseDefault 1
InterPOptions:interpCoord 0
InterPOptions:method 0
InterPOptions:numbInterpPoints 200
InterPOptions:splineOrder 3
InterPOptions:windowSize 6
MeshOptions:UseConformalCells 0
MeshOptions:UseDefault 1
MeshOptions:UseDiagonalCells 0
MeshOptions:maxX 100
MeshOptions:maxY 100
MeshOptions:meshDecimation 2
MeshOptions:meshDensity 2
MeshOptions:meshEdgeMeshing 1
MeshOptions:meshFreq 0.000000e+000
MeshOptions:meshMaxAspectRatio 10
MeshOptions:meshZeroThickness 1
MeshOptions:minX 1
MeshOptions:minY 1
SpiceExtract:Element 4
SpiceExtract:YMatrix 8
PartNumber
PartHelpPath
XmlPath
Project.Simulator.Analyze
Debug.Clear
ele.Properties("AXIEM Async:eDeEmbeddingMethod").Value = 1
em.Options("eAX_MESH_DECIMATION_OPTIONS") = 0
End Sub
The following describes how to do a 'mesh only' simulation through the API, when projects are too large for a full
simulation. You can perform a mesh-only simulation (for AXIEM) with project.EMStructures(x).CreateMesh. 2D
Annotation is automatically added when you run CreateMesh (if it did not exist). You still must add the 3D mesh
annotation if desired. Notice that this works with AXIEM.
The following describes how to simulate one EM document only. After simulation, a Data Set named "EM_Sim_DS0"
is created.
sch.AddExtraction
Project.EMStructures(1).Simulate("EM_Sim_DS0")
Wait(5)
Note that the API command is asynchronous. To verify whether or not a second simulation runs with the same EM
Structure, you must wait until the first simulation is complete and the Data Set is created.
Accessing an EM Schematic
An EMStructure document object has access to the Schematic properties. The following script shows how to see Schematic
Elements and access the parameters for those Elements. This script also shows how to access the Schematic Layout
drawing objects and attributes for the drawing objects.
You can access a Ports collection object directly at the EMStructure level. As previously noted, you have access to
EMPorts by traversing to the DrawingObjects ports were associated with, but this is an inconvenient programming model
when you only need to traverse the ports. It is convenient for adding a port to a specific shape, but inconvenient if you
only want to know the ports of an EMStructure without traversing all the Drawing objects in the design.
Debug.Clear
Set prts = Project.EMStructures("EM Structure 1").Ports
Debug.Print prts.Count
End Sub
Debug.Clear
Set prts = Project.EMStructures("EM Structure 1").Ports
Debug.Print prts.Count
prts.Remove(2)
Debug.Print prts.Count
End Sub
The following code is an example Deleting port in a multiport group. If EM ports are associated (attached) with the
rectangles that difficult to locate, and delete (port will go with them) try the following script:
Debug.Clear
Set ems = Project.EMStructures("MultiPort")
Debug.Print ems.Name
index = 1
For Each objDraw In ems.DrawingObjects
If (objDraw.EMPorts.Count > 0) Then
If (index = 1) Then
Set delObj1 = objDraw
index = index + 1
ElseIf (index = 2) Then
Set delObj2 = objDraw
index = index + 1
End If
End If
Next objDraw
End Sub
What this script does is look for DrawingObjects that have at least one EM port associated with them and then gets a
reference to the DrawingObject. Script uses a reference so we don't delete the objects while looping over them. It might
work but it is safer to finish looping before deleting the objects. The final step is to use the DrawingObject.Delete()
method on each drawing object you have a reference to to delete the objects.
Debug.Clear
Set prts = Project.EMStructures("EM Structure 1").Ports
Debug.Print prts.Count
prts.RemoveAll
Debug.Print prts.Count
End Sub
Debug.Clear
Set prts = Project.EMStructures("EM Structure 1").Ports
Debug.Print prts.Count
prts.Add(mwSPT_EdgePort, -10e-6, 350e-6, -640e-6, 350e-6)
Debug.Print prts.Count
End Sub
If the raw placement is too difficult you can use DrawingObject.EMPorts.Add, which adds it to a specific shape. Notice
that we have direct access to Drawing objects in the EM Structures.
Debug.Clear
Set em = Project.EMStructures("get")
For Each p In em.Ports
Debug.Print "port number = " & p.Number
Debug.Print vbTab & "port deembed = " & p.Deembed
Debug.Print vbTab & "port termination real= " & p.Termination.Impedance.Real
Debug.Print vbTab & "port termination imaginary= " & p.Termination.Impedance.Imaginary
Debug.Print vbTab & "port deembedding distance = " & p.ReferencePlaneDist
Next p
End Sub
Debug.Clear
Set ems = Project.EMStructures("EMS1")
Debug.Print ems.Name
End Sub
Debug.Print Title
For Each vtx In verts
Debug.Print "{ x = " & vtx.x & ", y = " & vtx.y & " } "
Next vtx
End Sub
EMS1
Conductor =
Deembed = True
Entity ID = -1
Flags = 0
Group Num = 0
Group Type= 0
Layer = 2
Line Type = -1
0
2
0
0
0
Excitation:
Angle = 0
Magnitude = 0
Impdedance:
Angle = 0
Magnitude = 50
Termination:
ExcitationAngle = 0
ExcitationSize = 1
ExcitationPort = False
Excitation Impedance:
Angle = 0
Magnitude = 50
Vertices:
{ x = 0.00023, y = 0.00013 }
{ x = 0.00023, y = -0.0002 }
{ x = 0.00023, y = 0.00013 }
{ x = 0.00023, y = -0.0002 }
{ x = 0.00023, y = 0.00013 }
Conductor =
Deembed = True
Entity ID = -1
Flags = 0
Group Num = 0
Group Type= 0
Layer = 2
Line Type = -1
0
1
0
0
0
Excitation:
Angle = 0
Magnitude = 1
Impdedance:
Angle = 0
Magnitude = 50
Termination:
ExcitationAngle = 0
ExcitationSize = 1
ExcitationPort = True
Excitation Impedance:
Angle = 0
Magnitude = 50
Vertices:
{ x = -0.00039, y = -0.0002 }
{ x = -0.00039, y = 0.00013 }
{ x = -0.00039, y = -0.0002 }
{ x = -0.00039, y = 0.00013 }
{ x = -0.00039, y = -0.0002 }
Conductor =
Deembed = False
Entity ID = -1
Flags = 0
Group Num = 0
Group Type= 0
Layer = 2
Line Type = -1
0
3
0
0
0
Excitation:
Angle = 0
Magnitude = 0
Impdedance:
Angle = 0
Magnitude = 50
Termination:
ExcitationAngle = 0
ExcitationSize = 1
ExcitationPort = False
Excitation Impedance:
Angle = 0
Magnitude = 50
Vertices:
{ x = -0.00008, y = -0.0002 }
{ x = -0.00008, y = 0.00013 }
{ x = -0.00008, y = -0.0002 }
{ x = -0.00008, y = 0.00013 }
{ x = -0.00008, y = -0.0002 }
When analyzing output you can notice that EM ports are defined with 5 Vertices. EM ports points you query for are not
what you think they are. You may think EM port has two points. It should return only two points. But thats not the query
was set up for. There are always 5 points returned when you query EM port as shown below:
1st point and 2nd point are the EM ports edge vertices.3rd and 4th point are EM ports shapes edge vertices. 5th point
is reference plane vertex if EM port has ref plane. Often time, 1st and 2nd points are the same 3rd and 4th points. If they
are different, then its sign of problem.
The following script shows the problem when working with the complex type for Magnitude and Angle values:
Debug.Clear
Set em = Project.EMStructures("get")
For Each p In em.Ports
Debug.Print "port number = " & p.Number
Debug.Print vbTab & "port deembed = " & p.Deembed
Debug.Print vbTab & "port termination real= " & p.Termination.Impedance.Real
Debug.Print vbTab & "port termination imaginary= " & p.Termination.Impedance.Imaginary
Debug.Print vbTab & "port deembedding distance = " & p.ReferencePlaneDist
Next p
End Sub
port number = 7
port deembed = True
port termination real= 50
port termination imaginary= 0
port deembedding distance = 0
port number = 5
port deembed = True
port termination real= 50
port termination imaginary= 0
port deembedding distance = 0
port number = 3
port deembed = True
port termination real= 35
port termination imaginary= 2
port deembedding distance = 0.00001
port number = 1
port deembed = False
port termination real= 50
port termination imaginary= 0
port deembedding distance = 0
port number = 2
port deembed = False
The following script sets parameters for the termination Excitation ports:
Sub Main
Dim em As EMStructure
Dim p As EMPort
Debug.Clear
Set em = Project.EMStructures("set")
For Each p In em.Ports
If p.Number=1 Then
Debug.Print "p.Number = 1"
Debug.Print "Termination.ExcitationPort: "; p.Termination.ExcitationPort
p.Termination.ExcitationPort=True
Debug.Print "After setting Termination.ExcitationPort: "; p.Termination.ExcitationPort
'p.Excitation.Magnitude=20
ElseIf p.Number=2 Then
Debug.Print "p.Number = 2"
Debug.Print "Termination.ExcitationPort: "; p.Termination.ExcitationPort
p.Termination.ExcitationPort=True
Debug.Print "p.Termination.ExcitationSignalSize: ";p.Termination.ExcitationSignalSize
p.Termination.ExcitationSignalSize=20.000 ' setting 20.026 in UI.
Debug.Print "p.Termination.ExcitationAngle: ";p.Termination.ExcitationAngle
p.Termination.ExcitationAngle=45
'p.Termination.Impedance.Magnitude=45
' p.Termination.Impedance.Angle=10
'p.Excitation.Magnitude=10.0
'p.Impedance.Magnitude=45
Debug.Print "After setting Termination.ExcitationPort: ";p.Termination.ExcitationPort
Debug.Print "p.Termination.ExcitationSignalSize: ";p.Termination.ExcitationSignalSize
Debug.Print "p.Termination.ExcitationAngle: ";p.Termination.ExcitationAngle
End If
Next p
End Sub
p.Number = 1
Termination.ExcitationPort: True
After setting Termination.ExcitationPort: True
p.Number = 2
Termination.ExcitationPort: True
p.Termination.ExcitationSignalSize: 20
p.Termination.ExcitationAngle: 45
After setting Termination.ExcitationPort: True
p.Termination.ExcitationSignalSize: 20
p.Termination.ExcitationAngle: 45
In the script get you can get most of the information, specifically the termination.impedance.real. In the set script,
however, the commands that did not work are commented out. The main problem is that in the complex type used for
these values, the Magnitude and Angle properties are read-only so you cannot assign them. The Read/Write properties
on these are the Real and Imaginary properties. Another problem is that the UI display is in dBm, however the API takes
value in base units. You can make the Magnitude and Angle values writeable, but there is a problem. You can convert
between Real and Imaginary and Magnitude and Angle, but the values are normally kept in Real/Image inside the system.
The assignment of Real and Imaginary is independent; you can assign either Real or Imaginary and the values are always
retained. However, when values are held in Real/Imaginary, assigning an Angle without any Magnitude is not retained,
so the assignment requires that the Magnitude be assigned before an Angle is applied. The following are some helpful
equations:
The following is example of setting excitation Port impedance. The script outputs the port state before and after updating
the impedance values and sets the values to two different states to ensure the updated are registered correctly. The state
of the ports are dumped out at each stage:
Debug.Print lay.Name
End Sub
End Sub
Debug.Print title
End Sub
Note that the arguments to the em.InvokeCommand() call must be passed as an array if arguments are required. This
command takes (x, y, rotation, flip) as arguments also, so, we need additional entries. One for the rotation angle in degrees
and Boolean to indicate if they should be flipped when placed or not. Keep in mind that when using the em.Activate
command, the command will give an error if there isn't already an existing view. In the following code an If-Then added,
that checks for this case and adds a view before the em.Activate call:
Debug.Clear
Set em = Project.EMStructures("Copy")
em.InvokeCommand("EditSelectAll")
em.InvokeCommand("EditCopy")
Set em = Project.EMStructures("Paste")
If (em.Windows.Count = 0) Then
em.NewWindow
End If
em.Activate
End Sub
The following code uses EMStructure.InvokeCommand("ShapeIntersect") and checks the location of the ports before
and after the boolean operation:
Debug.Clear
Set ems = Project.EMStructures("EMS1")
Debug.Print ems.Name
ems.SelectedObjects.AddAll
ems.InvokeCommand("ShapeIntersect")
End Sub
Debug.Print title
index = 1
For Each objDraw In ems.DrawingObjects
Debug.Print "Drawing Object[" & index & "] Ports: "
For Each emp In objDraw.EMPorts
Debug.Print "Port Number = " & emp.Number
Debug.Print "Vertices: "
For Each vtx In emp.Vertices
Debug.Print " Vertex Loc { x = " & vtx.x * 1e6 & ", y = " & vtx.y * 1e6 & " }"
Next vtx
Next emp
Debug.Print ""
index = index + 1
Next objDraw
End Sub
Accessing an EM Layout
An EMStructure document object has access to the Schematic object. The following script shows how to get EM Schematic
Layout document and how to work with EM Shapes using the same methods as for a Schematic Layout.
lay.SelectedObjects.AddFromArea(70e-6,-30e-6,280e-6,140e-6,mwAAT_ContainedObjects)
lay.SelectedObjects.AddFromArea(-80e-6,20e-6,90e-6,90e-6,mwAAT_ContainedObjects)
lay.InvokeCommand("EditorMakeSameSize")
lay.SelectedObjects.RemoveAll
End Sub
In general commands that require input will need some arguments to be supplied when they are invoked via
InvokeCommand. At some point in the past these may have put the user into path input mode and required the user do
digitize points, but that is not the intended behavior. That was because the command had not been modified to take
arguments and work correctly with InvokeCommand. All commands which require input either from the user or from a
dialog should take arguments that supply the values when Invoked via InvokeCommand through the API. The intended
behavior is that commands that require input should get the input via arguments supplied as an argument array in the
second argument of invoke command. A reason is that in general API and UI should be separate unless the script explicitly
creates a dialog using script, as mixing the two can cause scripts to hang. If the arguments are not correct for the command
the InvokeCommand() will fail to invoke the command but provides a usage statement as a return value which indicates
how the command is to be invoked. So for example, we can get the usage statement from the InsertPath command using
the following program::
Here we are providing a dummy arg value, and a return variant argument, and then printing what to get back. For this
command the return statement has the following string:
Error: Invalid Arguments, Usage: InsertPolygon(VARIANT argArray), where argsArray = Array(int numXY
double x2, double y2, ... , double xn, double yn)
The InsertPath and InsertPolygon are sharing the same error string but regardless this indicates that we need a number
to deall how many XY values we are supplying and then the XY values. So, the command should be invoked as follows:
Here we use Array() to pack multiple arguments into an variant argument for the command. When we invoke the command
this way we get a path from x = 0.0, y = 0.0 to x = 100e-6, y = 0.0 The format for invoking the "InsertPolygon is similar
but would requires a minimum of three points:
The following script shows how to draw a Circle to a specific EM Layer and Material in EM layout document. For this
we need to go to the Layout tab when the EM was active to set the material for example to 1oz CU so it would create a
layer, that shows up as a +LAY_2_1oz Cu_COND layer in the lower window. The created layer appears to be some
special EM layer so it is not accessible through the Project.ProcessDefinitions(1).LayerSetup. For the version that uses
the command set the layer we should use Project.LayerSetup.DrawingLayers.ActiveLayer to set and get the active layer.
For the version that uses the API DrawingObjects.AddEllipse() method we couldn't add to the shapes collection by adding
to the DrawingObjects collection. We can use the attributes collection on the drawing object to get the layer names back
because the shapes collection do not have access the special EM layer. So, the Circle will be drawn at the layer as
+LAY_2_1oz Cu_COND after running the script:
Code Module
Sub Main
Dim lay As Layout
Dim ret As Variant
Dim dl As DrawingLayer
Dim objDraw As DrawingObject
Debug.Clear
Set lay = Project.EMStructures(1).Schematic.Layout
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
Debug.Print lay.Name
Debug.Print "DrawingObjects Count = " & lay.DrawingObjects.Count
For Each objDraw In lay.DrawingObjects
PrintDrawingObject objDraw
Debug.Print ""
Next objDraw
End Sub
PrintParameters(drawingObj.Parameters)
End Sub
End Sub
To print out the Drawing Layer Names use the following code:
Sub Main
Dim lay As DrawingLayer
End Sub
The following script shows how to Copy / Paste a cell object which is plated to EM layout document:
ems.InvokeCommand("EditCopy")
ems.InvokeCommand("EditPasteFlatten", Array(0,0), ret)
Debug.Print ret
End Sub
This code selects all the elements, copies them into the clipboard and then pastes them back into the EM design using
the EditPasteFlatten command and the coordinate x=0.0 y=0.0. Looking at the EM Layout afterward the original shapes
are still there but there is also an additional copy. In the additional copy the plated line cell has been turned into 3
rectangles indicating that it was flattened.
The following script shows Stretch Area command working on a polygon in an EM Schematic Layout document using
the InvokeCommand() method. The script will find the area definition shape that should be set before the script run (see
picture below), and then invoke the Stretch Area command to stretch the EM structure with the port in that area. Stretch
area command defined by ShapeStretch takes 4 arguments to define a rectangular selection region for the vertices to
be stretched and then two arguments to define the dx and dy:
Dim em As EMStructure
Dim lay As Layout
Dim objDraw As DrawingObject
Dim sh As Shape
Dim ret As Variant
Dim xyArray(1) As Double
Debug.Clear
xyArray(0)= 1e-3
xyArray(1)= 0
The following script shows how to stretch Shapes for EM Structure Layout using Edit Handles Move Command:
Debug.Clear
'Check info text, to make sure correct drawing object is being stretched.
For Each objDraw In lay.DrawingObjects
'Debug.Print objDraw.InfoText
If InStr(objDraw.InfoText,"+LAY_3_Lay4_COND") > 0 Then
'Select middle edit handle on left side of rectangle
Set eh = objDraw.EditHandles(8)
'Move edit handle 50mils in x direction
eh.Move(50*25.4/1e6, 0)
End If
Next objDraw
Project.EMStructures(1).Changed =True
Project.EMStructures(1).Update
ems.Schematic.Layout.Refresh
End Sub
Whenever you change the EM layout through API, you should do this:
ems.Changed =True
ems.Update
The following script shows how to provide InvokeCommand() for Union Shapes for EM Structure Layout:
The following script shows how to provide Shape Mirror for EM Structure Layout.There are several Mirror type commands
in the command table. For the EM Structure layout we should use the following command and the arguments for the
command are x1, y1, x2, y2 of the mirror line:
Debug.Clear
Set lay = Project.EMStructures("EM Structure 1").Schematic.Layout
For Each objDraw In lay.DrawingObjects
objDraw.Selected = True
Next objDraw
End Sub
The following script shows how to rotate shapes in an EM Schematic Layout document using the same methods as for
a Schematic Layout:
End Sub
We added method to several document level objects in the API to allow commands to be started, similar to the way
InvokeCommand works but without supplying the arguments, so, the command can be completed interactively by the
user. There have been a few instances in the past where there have been requests to develop assistive scripts which help
the user accomplish a task but require input from the user to perform the desired actions. The model for the standard API
methods is not to have interaction with any UI elements other than updating them to reflect the results of changes the
methods have made. The same goes for InvokeCommand(), the method is intended to be a parametric API for completing
tasks using command objects, so the model for InvokeCommand is to supply any input required to complete the command
as arguments to the method in a variant array. These new StartCommand methods provides a mechanism to support
starting commands that would place the user into an interactive mode to complete the command.
End Sub
The following code shows access to View > Visual > Shapes Merged option:
Debug.Clear
Set schem = Project.Schematics("Via_on_Plane")
If (schem.Layout.ThreeDViews.Count = 0) Then
schem.NewWindow(mwWT_Schematic3DLayout)
End If
End Sub
We can send a script to 3D editor to change material color. Usually the script is written with Pyton commands:
Sub Main
Dim em3d As EM3DStructure
Dim extEd As ExternalEditor
Dim cmds As String
Debug.Clear
em3d.Enabled=False
End Sub
We have support in the API to both Lock and Unlock the parameterized layout. When the call to unlock is made api also
provides update of the layout.
Dim em As EMStructure
Dim sch As Schematic
Dim ele As Element
Dim param As Parameter
Debug.Clear
ele.LockParameterizedLayout = True
ele.Parameters("InLen").ValueAsDouble=400
ele.Parameters("DieLen").ValueAsDouble=400
ele.Parameters("OutLen").ValueAsDouble=400
ele.LockParameterizedLayout = False
Where the call ele.LockParameterizedLayout = False at the end both Unlocks the layout and requests for it to be updated.
You can access equations directly on an EM Structure object as shown in the following code:
Project.EMStructures(1).Equations
Project.EMStructures(1).Schematic.Layout.Equations
Sub Main
Dim su As StackupUtil
Set su = MWOffice.StackupUtil
Dim s As Element
Set s = Project.EMStructures(1).Schematic.Elements("STACKUP.SUB")
su.SetStackup(s)
su.ClearStackup()
su.InsertDielectricLayer("AIR", 1, 0.0002032)
su.InsertDielectricLayer("FR4", 2, 0.0002032)
su.InsertDielectricLayer("FR4", 3, 0.0002032)
su.InsertDielectricLayer("FR4", 4, 0.0002032)
su.InsertDielectricLayer("AIR", 5, 0.0002032)
To access SPP rules converted from options, use the EM Stackup Element:
Dim em As EMStructure
Dim ele As Element
Dim p As Parameter
Set em = Project.EMStructures(1)
Set ele = em.Schematic.Elements("STACKUP.SUB")
Debug.Print ele.Parameters("SppRules").ValueAsString
"
28
If the STACKUP Element is in a Global Definitions document, access to SPP Rules is slightly different:
End Sub
To add a STACKUP Element to Global Definitions and show the parameters, use the following script:
End Sub
Name
DieT
DieInd
DScale
GndInd
GndCond
TrcName
T
W
MinW
MatInd
TScale
EtchAng
Surf
LTName
LayName
LayInd
LtGInd
LtUInd
TrcInd
TrcUInd
TrcGInd
LTFlags
ViaCell
VPName
ViaLay
VProp
MatName
MatType
Color
ErZ
ErX
ErY
UrZ
UrX
UrY
SigmaZ
SigmaX
SigmaY
TanDZ
TanDX
TanDY
TanMZ
TanMX
TanMY
ErZEQ
ErXEQ
ErYEQ
UrZEQ
UrXEQ
UrYEQ
TanDZEQ
TanDXEQ
TanDYEQ
TanMZEQ
TanMXEQ
TanMYEQ
ResSq
ResF
React
LpfName
emMapName
ResSqEQ
ReactEQ
SppRules
You can create the stackup, but there is no method via the API to create the EM document with that stackup from the
Global Definitions as part of the initialization.
EM2lines:1
You can copy an EMStructure to the Clipboard using the CopyToClipboard method.
You can copy an EMStructure to another EM Structure using the Invoke Command method:
Debug.Clear
Set em = Project.EMStructures("Copy")
em.InvokeCommand("EditSelectAll")
em.InvokeCommand("EditCopy")
Set em = Project.EMStructures("Paste")
If (em.Windows.Count = 0) Then
em.NewWindow
End If
em.Activate
End Sub
Note that the arguments to the em InvokeCommand() call must be passed as an array if arguments are required. Also
this command takes (x, y, rotation, flip) as arguments so we need two additional entries. One for the rotation angle in
degrees and Boolean to indicate if they should be flipped when placed or not. We use the em.Activate command, so, this
will not give an error if there isn't already an existing view. We added an If-Then above that checks for this case and
added a view before the em.Activate call.
Activating an EM Structure
To activate an EM structure, use the following code:
Exporting EM Structures
The following script demonstrates the API ability to Export an EMStructure:
The following script demonstrates the API method EMStructure.ExportEMInputDataXML(string path) to export EM
input data in XML format. There are two examples od code. First example provides a call on the EM Structure object
to allow the EM Input data to be exported in XML format in standard EM socket XML format. The second example
provides a call on the EM Structure object to allow the EM Input data to be exported in XML format in simplified EM
Socket XML format.
End Sub
Sub Main
Dim em As EMStructure
Debug.Clear
Set em = Project.EMStructures("em")
em.SelectedObjects.AddAll
Debug.Print "Start"
em.InvokeCommand("AwrOutputEMInputData")
Debug.Print "Done"
End Sub
It is no longer necessary to go through the Schematic and Layout from the EM Structure. The calls for em.SelectedObjects
and em.InvokeCommand can be performed directly on the EM Structure object
Note that SPP is triggered when outputting the .emi data. You can set a timer for before and after simulation events to
time the SPP rules process run.
Dim t1 As Double
Dim t2 As Double
GenEmData(emDoc)
t2 = Timer
t = awr_timer(t1,t2)
fn = AWR_get_perf_file
Open fn For Append As #1
tks = Split(Project.Name,".")
Print #1, Chr(34) & tks(0)& "@sim_time" & Chr(34) & vbTab & t
Close #1
End Sub
End Function
bd = MWOffice.BuildNumber ' need to be able to get minor number, need that in the API.
'folder location
pth = MWOffice.Directories(2).ValueAsString & "\testresults\"
'pth = "C:\AWR_PerfLogs\"
'check to make sure path exists, more for testing than running code.
If objFileSystem.FolderExists(pth) = False Then
objFileSystem.CreateFolder(pth)
End If
fn = pth & "DesEnv_B" & MWOffice.BuildNumber & "_R" & MWOffice.BuildRevision & ".per"
If objFileSystem.FileExists(fn) = False Then
Open fn For Output As #1
Print #1, """Name""" & vbTab & """Time(s)$T"""
Close #1
End If
AWR_get_perf_file = fn
End Function
Sub Main
If Project.EM3DStructures.Exists("My3DStructure") Then
Else
Dim em3d As EM3DStructure
Dim extEd As ExternalEditor
The Python script is in DataFile node of the project tree and is a text data:
import analyst
Model_1 = analyst.GetModel()
VariableManager_1 = Model_1.GetVariableManager()
Variable_1 = VariableManager_1.NewVariable("inner_length", "1.5 cm", "new variable for Height", "0"
Variable_2 = VariableManager_1.NewVariable("inner_radius", "0.1 cm", "new variable for Radius", "0"
Structure_1 = Model_1.GetStructure()
Geometry_1 = Structure_1.GetGeometry()
Solid_1 = Geometry_1.Cylinder("Cylinder_1", "World", "Air", "0, 0, 0", "0, 0, 1", "inner_length", "
Solid_1.SetExMaterial("Perfect Conductor")
Variable_3 = VariableManager_1.NewVariable("outer_height", "1.1 cm", "new variable for Height", "0"
Variable_4 = VariableManager_1.NewVariable("outer_to_inner_ratio", "0.632455532033676 cm", "new var
Variable_4.SetExValue("4")
Solid_2 = Geometry_1.Cylinder("Cylinder_2", "World", "Perfect Conductor", "0, 0, 1.35525271560688e-
Solid_2.SetExMaterial("Air")
ViewConfig_1 = Geometry_1.GetViewConfig()
ViewConfig_1.SetIsolated(None)
Variable_6 = VariableManager_1.NewVariable("outer_radius", "outer_to_inner_ratio*inner_radius", "my
ViewConfig_1.SetIsolated(Solid_2.Get_IIsolatable())
SolidOperation_2 = Solid_2.Get_ISolid().GetOperation(0)
SolidOperation_2.Get_ICylinder().SetExRadius("outer_radius")
Variable_4.SetExValue("5")
ViewConfig_1.SetIsolated(Solid_1.Get_IIsolatable())
Camera_1 = ViewConfig_1.Get_IView3DConfig().GetCamera()
AttributeSet_1 = Structure_1.GetAttributeSet(0)
RF_Port_1 = AttributeSet_1.NewExcitation("RF_Port")
Application_1 = Solid_1.Get_ISolid().ApplyAttributeFace(RF_Port_1, 0, 2)
The next Script changes color in 3D editor, then checks the color from MWO:
' This code checks that changes to a material color in 3D editor is transferred back to MWO
Dim em3d As EM3DStructure
Dim extEd As ExternalEditor
Dim cmds As String
Debug.Clear
em3d.Enabled=False
The Python script is in DataFile node of the project tree and is a text data:
Model_1 = analyst.GetModel()
Structure_1 = Model_1.GetStructure()
Geometry_1 = Structure_1.GetGeometry()
ViewConfig_1 = Geometry_1.GetViewConfig()
MaterialManager_1 = Geometry_1.GetMaterialManager()
Material_4 = MaterialManager_1.Get("geeamaterial")
ViewConfig_1.Get_IView3DConfig().AddIsolated((Material_4.Get_IIsolatable()))
Material_4.Get_IAttribute().SetExColor("255, 0, 38, 255")
Dim gs As Graphs
Dim g As Graph
Set gs = Project.Graphs
Set g = gs.Add("New Graph",mwGT_Rectangular)
The "Add" function does not overwrite an existing Graph. If the Graph named "New Graph" already exists, the new
Graph is named "New Graph1".
This example uses the Add method, which takes two arguments (the name of the Graph you want to add, and the constant
that defines the Graph type).
Constants that define different types of graphs available via the API are shown in the following table:
Name Value
mwGT_Polar 1
mwGT_SmithChart 2
mwGT_Rectangular 3
mwGT_Tabular 4
mwGT_Antenna 5
mwGT_Histogram 6
mwGT_ThreeDim 7
mwGT_Constellation 8
You can set all types of Graphs that are shown in the table.
In the previous example, "g" is the created reference to the "New Graph". After running the script, a new subnode named
"New Graph" displays under the Graphs node in the Project Browser.
To Add a measurement to the graph using the HSPICE simulator, use the following code:
Dim gs As Graphs
Dim g As Graph
Set gs = Project.Graphs
Set g = gs.Add("New Graph",mwGT_Rectangular)
g.Measurement.Add("TOP.HS","S(2,2)")
To Return the index of the plot axis for the measurement (you can also set the Index), use the following code:
Debug.Print m.AxisIndex
The NI AWR SDE allows you to Copy a graph (including tabular graph) to the Clipboard.
You can configure how Graphs display. You can change settings such as colors, fonts, labels, traces, Axes collection
properties, Border Properties, Title, and TickMarks properties.
The following are examples of code to access different Graph objects and properties.
To print the graph name and type, use the following code:
Dim g As Graph
Set g = Project.Graphs(1)
Print #1, "Graph";
Debug.Print "Name=" & g.Name;
Debug.Print "Type=" & g.Type;
The API provides access to the Attributes collection of objects for all types of Graphs. The Attributes collection provide
named values that correspond to the values you can set when accessing the Options dialog box for a grid. All of the
options available in the Graph Options dialog boxes are available through the Graph.Attributes collection.
Debug.Clear
For Each grp In Project.Graphs
For Each atr In grp.Attributes
Debug.Print atr.Name;vbTab;atr.Type;vbTab;atr.Value;vbTab;atr.ValueAsString
Next atr
Next grp
End Sub
ChartStyle 2 0 0
GraticuleColor 2 0 0
MajorDivisionsColor 2 9 9
MinorDivisionsColor 2 9 9
XAxisLineStyle 2 0 0
LeftYAxisLineStyle 2 0 0
RightYAxisLineStyle 2 0 0
ShowTickMarks 0 True -1
TickMarkSize 5 3 3
UseDefaultXLabel 0 True -1
DefaultXLabel 6
ChartStyle 2 0 0
DefaultSweepRange 0 False 0
SweepDisplayMin 5 30000000000 30000000000
SweepDisplayMax 5 40000000000 40000000000
ImdedanceGridVisible 0 True -1
AdmittanceGridVisible 0 False 0
ValuesVisible 0 True -1
AutoSize 0 False 0
ChartSize 2 1 1
AutoContour 0 False 0
ContourDensity 2 1 1
GraticuleColor 2 0 0
ImdedanceColor 2 9 9
AdmittanceColor 2 9 9
ImpedanceLineStyle 2 0 0
AdmittanceLineStyle 2 0 0
SweepMinimum 5 30000000000 30000000000
SweepMaximum 5 1 1
ChartStyle 2 0 0
GraticuleColor 2 0 0
MajorDivisionsColor 2 9 9
MinorDivisionsColor 2 9 9
XAxisLineStyle 2 0 0
LeftYAxisLineStyle 2 0 0
RightYAxisLineStyle 2 0 0
ShowTickMarks 0 True -1
TickMarkSize 5 3 3
UseDefaultXLabel 0 True -1
DefaultXLabel 6
We can use attributes collection for setting the sweep minimum and sweep maximum on Smith chart Graph:
Sub Main
Debug.Clear
Dim g As Graph
Set g = Project.Graphs(1)
g.Attributes("SweepMinimum").Value = 200000
End Sub
Set g = Project.Graphs(1)
write_props g
End Sub
Printing Four "x" and "y" Points for the Graph "Arc"
The following script prints out all "x" and "y" points for the "arc" on the Graph.
Set ds = Project.Graphs(1).DrawingShapes(1)
For i = 1 To ds.Points.Count
Debug.Print "Point " & i
Debug.Print vbTab & "x= " & ds.Points(i).x
Debug.Print vbTab & "y= " & ds.Points(i).y
Next i
End Sub
You can set the left or right axis of a trace on a graph through the NI AWR SDE. Trace objects are children of a Graph
object. The MWOffice Graphs collection has two graph forms: the first has four individual measurements, and the second
has a single measurement but has an "All Sources" data source. You can set the axis of each trace individually on the
first form; however, when you try to set the axis of a single trace on the second form, it applies it to ALL of the traces.
If you have access to the individual traces, you should not be able to set the axis of each individually. The axis is applied
to each measurement object. This is not logical, but is because the left/right property is really for a measurement.
Note that Rectangular graphs support multiple left and right y-axes that you can specify through the NI AWR SDE using
the PlotAxis property of the Trace object. This method sets the axis on which to plot the Trace as shown in the previous
script.
ax.MajorGridlinesWeight = mwFat
ax.MinorGridlinesColor = RGB(0, 0, 0)
' Now Print values to check.
Debug.Print "Gridline Labels Visible = " & ax.GridlineLabelsVisible
Debug.Print "Label Units Visible = " & ax.LabelUnitsVisible
Debug.Print "Axis Major GridLine Color = " & ax.MajorGridlinesColor
Debug.Print "Axis Major Gridline Weight = " & ax.MajorGridlinesWeight
Debug.Print "Axis Minor Gridline Color = " & ax.MinorGridlinesColor
Next ax
Next gp
End Sub
Name = Graph 1
Gridline Labels Visible = True
Label Units Visible = True
Axis Major GridLine Color = 12632256
Axis Major Gridline Weight = 1
Axis Minor Gridline Color = 12632256
Gridline Labels Visible = False
Label Units Visible = False
Axis Major GridLine Color = 0
Axis Major Gridline Weight = 5
Axis Minor Gridline Color = 0
Gridline Labels Visible = True
Label Units Visible = False
Axis Major GridLine Color = 0
Axis Major Gridline Weight = 5
Axis Minor Gridline Color = 0
Gridline Labels Visible = False
Label Units Visible = False
Axis Major GridLine Color = 0
Axis Major Gridline Weight = 5
Axis Minor Gridline Color = 0
Gridline Labels Visible = True
Label Units Visible = False
Axis Major GridLine Color = 0
Axis Major Gridline Weight = 5
Axis Minor Gridline Color = 0
Gridline Labels Visible = False
Label Units Visible = False
Axis Major GridLine Color = 0
Axis Major Gridline Weight = 5
Axis Minor Gridline Color = 0
You can manipulate and set all of the properties listed above.
grp.Axes.Item(2).AutoScale=True
grp.Axes.Item(2).MajorGridlinesAutoStep=True
Else
grp.Axes.Item(1).AutoScale=False
grp.Axes.Item(1).MaximumScale=3
grp.Axes.Item(1).MinimumScale=1
grp.Axes.Item(1).MajorGridlinesAutoStep=False
grp.Axes.Item(1).MajorGridlinesStep=1.25
grp.Axes.Item(2).AutoScale=False
grp.Axes.Item(2).MaximumScale=2.25
grp.Axes.Item(2).MinimumScale=0
grp.Axes.Item(2).MajorGridlinesAutoStep=False
grp.Axes.Item(2).MajorGridlinesStep=1.75
grp.Traces.Item(1).Weight=mwMedium
End If
Debug.Print grp.Axes.Item(2).MajorGridlinesStep;" ";grp.Axes.Item(1).MajorGridlinesStep
You can access all axes properties that are in the following script:
Set g = Project.Graphs(1)
For Each ax In g.Axes
write_axes ax
Next ax
End Sub
problem:
Resume Next
End Sub
End Sub
You can also add and remove graph axes. In addition you have API access to non-rectangular graphs and can set values
for all types of graphs, for example, Axes(1).Minimumscale and Axes(1).Maximumscale as in the following script:
To set the initial range you need to run at least one simulation before running the script. This script generates the following
output:
20 50
30 40
You have access to AxisPointLabels for the measurements, which allows access to string values used for axis label points.
The following is an example of accessing the AxisLabelPoints:
Set g = Project.Graphs("yield_vals")
Debug.Clear
count = g.Measurements(1).AxisPointLabelCount
For i = 1 To count
Debug.Print g.Measurements(1).AxisPointLabel(i)
Next i
End Sub
Running this on the test project after 100 iterations of yield analysis produces the following in the debug window:
@BPF_Half\@BPF_Half\S1
@BPF_Half\@BPF_Half\S2
@BPF_Half\@BPF_Half\S4
@BPF_Half\@BPF_Half\W0
@BPF_Half\@BPF_Half\W1
@BPF_Half\@BPF_Half\W2
BPF_Half\TMM 10_1\Er
BPF_Half\TMM 10_1\H
The following script gets simulator string from the measurements collection:
Sub Main
Dim m As Measurement
Dim mi As MeasurementInfo
Set m = Project.Graphs(1).Measurements(1)
Debug.Print m.Source
Set mi = MWOffice.MeasurementInfos("S")
Debug.Print mi.SimId
End Sub
The source name will be the simdoc name plus any simulator tags, disabled sweeps, etc. The SimId off the measurement
info is the simulator type. LIN for linear, NLN nonlinear, SYS for VSS, etc.
Name = Graph 1
Color = 0
Color = 8421504
Color = 0
The following script is using measurement.tracevalue property for iterating through traces
Next
For i = 1 To m.XPointCount
Debug.Print vbTab & info & "x=" & m.XValue(i) & ",y=" & m.YValue(i,trace_index)
Next
Next trace_index
Debug.Print
End Sub
X and Y Values
Trace 1
R1=25,R2=10,x=1000000000,y=35
R1=25,R2=10,x=2000000000,y=35
Trace 2
R1=30,R2=10,x=1000000000,y=40
R1=30,R2=10,x=2000000000,y=40
Trace 3
R1=25,R2=20,x=1000000000,y=45
R1=25,R2=20,x=2000000000,y=45
Trace 4
R1=30,R2=20,x=1000000000,y=50
R1=30,R2=20,x=2000000000,y=50
Trace Values
Trace 1
R1=25,R2=10,x=1000000000,y=35
R1=25,R2=10,x=2000000000,y=35
R1=25,R2=10,y=35
R1=25,R2=10,y=35
Trace 2
R1=30,R2=10,x=1000000000,y=40
R1=30,R2=10,x=2000000000,y=40
R1=30,R2=10,y=40
R1=30,R2=10,y=40
Trace 3
R1=25,R2=20,x=1000000000,y=45
R1=25,R2=20,x=2000000000,y=45
R1=25,R2=20,y=45
R1=25,R2=20,y=45
Trace 4
R1=30,R2=20,x=1000000000,y=50
R1=30,R2=20,x=2000000000,y=50
R1=30,R2=20,y=50
R1=30,R2=20,y=50
To modify the trace Color and DashStyle, use the following script:
Set g = Project.Graphs(1)
'print measurement and trace info
i = 1
For Each m In g.Measurements
Set t = g.Traces(i)
Debug.Print "Measurement" & vbTab & m.Source & vbTab & m.Type
Debug.Print t.MeasurementName & vbTab & t.DefaultStyle & vbTab & t.CompatibleStyle
Debug.Print t.Color & vbTab & t.DashStyle & vbTab & t.FrequencyArrows
Debug.Print t.LegendText & vbTab & t.LegendText2 & vbTab & t.PlotAxis
Debug.Print t.Style & vbTab & t.Symbol & vbTab & t.SymbolInterval
Debug.Print t.SymbolSize & vbTab & t.SymbolVisible & vbTab & t.TextVisible
Debug.Print t.Visible & vbTab & t.Weight & vbTab & t.SymbolIntervalAuto & vbTab & m.AxisIndex
i = i+1
Next m
End Sub
To export trace data from a Graph object, use the Graph.ExportTraceData() method which takes an export file name and
then attempts to export the data to that file name.
Project.Graphs("GRPH1").ExportTraceData(fwrite)
The following script shows how to access the Graph Legend object:
Font = Arial
Height = 800 Width = 1141
The following script shows how to access Graph Legend object properties:
Set g = Project.Graphs(1)
Set font = g.Legend.Font
Debug.Print "Legend" & vbTab & g.Legend.BorderShadow & vbTab & g.Legend.BorderVisible
Debug.Print g.Legend.Color & vbTab & font.Bold & "," & font.Charset
Debug.Print font.Italic & "," & font.Name & "," & font.Size & "," & font.Strikethrough
Debug.Print font.Underline & "," & font.Weight & vbTab & g.Legend.Height & vbTab & g.Legend.Left
Debug.Print g.Legend.Text2Visible & vbTab & g.Legend.TextVisible & vbTab & g.Legend.Top
ebug.Print g.Legend.Visible & vbTab & g.Legend.Width
End Sub
The following code shows how to access legend text for graphs
API has properties that specify if we use Default values or not for setting Graph Legend Text. Boolean properties names
are: UseDefaultLegendText and UseDefaultLegendText2. The code allows you to access legend text properties and
values:
Debug.Print Project.Graphs(1).Traces(1).LegendText
Debug.Print Project.Graphs(1).Traces(1).LegendText2
Debug.Print Project.Graphs(1).Traces(1).UseDefaultLegendText
Debug.Print Project.Graphs(1).Traces(1).UseDefaultLegendText2
The following script shows how to add Marker object to a graph trace:
End Sub
Debug.Print "---"
Debug.Print ""
Next mk
End Sub
PrintMarkerProperties(gph)
End Sub
The following script shows how to access Marker object properties and options:
End Sub
The following script will display the value of every trace at each marker's x value:
' Place regulars Markers (Not vert Or horiz), and run this script.
' It will display the value of every trace at each marker's x value.
' Size of display text is controlled by "size" variable, below.
' WARNING: this script will remove all drawing objects (user added text/graphics).
Debug.Clear
Size = 75
' Make sure the active window is a graph and has at least one trace marker.
For Each wn In Windows
If wn.Active Then
If wn.Type = mwWT_Graph Then Set gr = Project.Graphs(wn.Caption)
Exit For
End If
Next wn
If wn.Type ne mwWT_Graph Then
MsgBox("Active window must be a graph.")
Exit Sub
ElseIf gr.Markers.Count = 0 Then
MsgBox("Graph must contain at least one trace marker.")
Exit Sub
End If
' For each marker, for each measurement, for each curve,
' interpolate y value at xv, and place that value as text at that location.
For Each mk In gr.Markers
xv = mk.SweepValue
For Each ms In gr.Measurements
ny = ms.YDataDim
ReDim md(ny) As Double
For yi = 1 To ny
md(yi) = LInterp(ms.XValues,ms.YValues(yi),xv)
' Debug.Print xv;vbTab;md(yi)
gr.DrawingShapes.AddText(gr.GridToLogicalCoordinateX(xv/Project.Units(mwUT_Frequency).MultValue
' Debug.Print gr.GridToLogicalCoordinateX(xv/Project.Units(mwUT_Frequency).MultValue);vbTab;gr.G
Next yi
Next ms
Next mk
End Sub
' Use provided xvals and yvals value arrays to interpolate new y for x
' Warning: not very bright, expects x to be within range of xvals and yvals.
' Probably won't work for traces where xvals is non-monotonic
Function LInterp(xvals() As Double, yvals() As Double, x As Double) As Double
Dim y As Double
Dim xi As Double
Dim xi0 As Double
Dim xmin As Double
Dim xmax As Double
xmin = xvals(0)
xmax = xvals(0)
For i = 1 To UBound(xvals)
xi = xvals(i)
xi0 = xvals(i-1)
If x = xi Then
y = yvals(i)
' Debug.Print xi0; vbTab; yvals(i-1)
' Debug.Print xi; vbTab; yvals(i);vbTab;y
End Function
Please, keep in mind that the script above should not be used for all graphs and measurements
The following code shows how to change the size of Graph's markers using a script:
Debug.Clear
mk.Display.Height = 500
mk.Display.Left = mk.Display.Left + 10
mk.Display.Top = mk.Display.Top + 10
mk.Display.Width = mk.Display.Width + 10
Debug.Print "Display Width = " & mk.Display.Width
Next mk
End Sub
The following code shows how to move marker label using a script. This example is moving the Marker Label up and
to the right:
End Sub
The following script shows API support for moving marker to min and max values along a trace. Test places two markers
then moves them to max and minimum values along two traces. At each placement the details of the marker object state
are printed out :
Option Explicit
' Code Module
Sub Main
Dim gph As Graph
Dim m1 As Marker
Dim m2 As Marker
m1.SweepValue = 2e9
m2.SweepValue = 2e9
m1.SweepValue = 2.5e9
m2.SweepValue = 2.5e9
Debug.Print title
Debug.Print "---"
Next mk
Debug.Print ""
End Sub
The following script shows API support for moving marker to min and max values along a trace. Test places two markers
then moves them to max and minimum values along two traces. At each placement the details of the marker object state
are printed out as in previous script:
Option Explicit
' Code Module
Sub Main
Dim gph As Graph
Dim m1 As Marker
Dim m2 As Marker
m1.MoveToMaximum
m2.MoveToMaximum
m1.MoveToMinimum
m2.MoveToMinimum
We have support to the API grid marker object. Those changes include the ability to set the Sweep Value for a marker
and allow the marker to be moved within a grid.
m1.SweepValue = 2e9
m2.SweepValue = 2e9
m1.SweepValue = 2.5e9
m2.SweepValue = 2.5e9
End Sub
In the script the PrintMarkerProperties(gph) code is already shown above. Markers.AddEx() method takes a trace index
in addition to all the parameters that Add() took previously. In the code we place two markers and then move them twice
by assigning into the sweep value properties. Each time the markers is placed the state of the marker object is printed
out.
m1.MoveToMaximum
m2.MoveToMaximum
m1.MoveToMinimum
m2.MoveToMinimum
End Sub
Debug.Print title
Debug.Print "---"
Debug.Print ""
Next mk
We improved trace access in the graph marker objects so that the marker trace index can be specified via the trace index
property and the max trace index property returns the number of traces available in the measurement data. The
Marker.TraceIndex property reports and set the trace index and provides an indication of the range of values that can be
assigned to the marker. The following code shows how to switch graph Marker trace:
m1.TraceIndex = 2
End Sub
For the PrintMarkerProperties gph code please look at the previous code.
m1.Search(-0.0035)
m1.Search(-0.004)
End Sub
For the PrintMarkerProperties gph code please look at the previous code.
The following code shows how to access Smith Chart Markers Options. Please keep in mind that it should be AfterSimulate
Event:
PrintMarkerOptions(gph)
Next gph
End Sub
Sub PrintMarkerOptions(ByRef gph As Graph)
Dim mk As Marker
Dim op As Option
' Print marker options details.
Debug.Print gph.Name & " Marker Options: "
Debug.Print "Normalized = " & gph.Markers.Options.Normalized
Debug.Print "Color = " & gph.Markers.Options.Color
Debug.Print "ConnectorVisible = " & gph.Markers.Options.ConnectorVisible
Debug.Print "ConnectorWeight = " & gph.Markers.Options.ConnectorWeight
Debug.Print "DataMarkersInLegend = " & gph.Markers.Options.DataMarkersInLegend
Debug.Print "DisplayFormat = " & gph.Markers.Options.DisplayFormat
Debug.Print "DisplayType = " & gph.Markers.Options.DisplayType
Debug.Print "EnableParameterMarkers = " & gph.Markers.Options.EnableParameterMarkers
Debug.Print "FrequencyVisible = " & gph.Markers.Options.FrequencyVisible
Debug.Print "Options.MarkerSymbol = " & gph.Markers.Options.MarkerSymbol
Debug.Print "ParameterMarkersInLegend = " & gph.Markers.Options.ParameterMarkersInLegend
Debug.Print "RefImpedance = " & gph.Markers.Options.RefImpedance
Debug.Print "RefMarkerAllTraces = " & gph.Markers.Options.RefMarkerAllTraces
Debug.Print "SymbolSize = " & gph.Markers.Options.SymbolSize
Debug.Print "SymbolVisible = " & gph.Markers.Options.SymbolVisible
Debug.Print "TiedToLabel = " & gph.Markers.Options.TiedToLabel
Debug.Print "Transparent = " & gph.Markers.Options.Transparent
Marker Options:
Normalized = True
Color = 0
ConnectorVisible = True
ConnectorWeight = 0
DataMarkersInLegend = False
DisplayFormat = 0
DisplayType = 3
EnableParameterMarkers = True
FrequencyVisible = True
Options.MarkerSymbol = 9
ParameterMarkersInLegend = True
RefImpedance = 50
RefMarkerAllTraces = False
SymbolSize = 5
SymbolVisible = True
TiedToLabel = True
Transparent = False
----------------------
EnableParameterMarkers = True
FrequencyVisible = True
Options.MarkerSymbol = 9
ParameterMarkersInLegend = True
RefImpedance = 20
RefMarkerAllTraces = False
SymbolSize = 5
SymbolVisible = True
TiedToLabel = True
Transparent = False
----------------------
Debug.Clear
'get graph
Set g = Project.Graphs(1)
g.Legend.Color= clr
g.TitleFont=font
g.TitleColor= clr
End Sub
Graph fonts are Type objects, so they are handled differently than most other graph settings. The following code snippet
shows how to get and set font information. You can make a Project with any graph and run this code to see labels, legend,
and title font changes. You must add a new reference to get the StdFont type. Choose Edit > References and then select
the OLE Automation reference. If there is more than one reference, select the highest numbered reference.
Debug.Clear
'get graph
Set g = Project.Graphs(1)
End Sub
The following figure shows the graph before you run the code.
The following figure shows the graph after you run the code.
Bold=False
Character Set=0
Italic=False
Name=Arial
Size=18
Strike through=False
Underline=False
Weight=400
Color=0
The following script hides the Title if it was visible before running the script:
gp.TitleVisible = True
End If
' Print the result of the changed Title visible property
Debug.Print "After changing";vbTab;gp.TitleVisible
Next gp
End Sub
Setting LabelText
You must set the Label.Visible property to "True" before setting LabelText. The following code allows you to toggle
the Visible property to set LabelText:
Project.Graphs(1).Axes(1).LabelVisible = True
Debug.Print Project.Graphs(1).Axes(1).LabelText
Project.Graphs(1).Axes(1).LabelText = "test setting label"
Debug.Print Project.Graphs(1).Axes(1).LabelText
Axis::LabelColor
Axis::GridlineLabelsColor
Graph::TitleColor
Legend::Color
Trace::TextColor
Trace::LegendKeyColor
Project.Graphs("Graph 1").NewWindow
Use the ViewAll method for the Window object when calling this on a GraphWindow to view the entire graph inside
the display window.
Dim g As Graph
'simulate project
Project.Simulator.Analyze
gname ="One Tone Load Line"
Set g = Project.Graphs(gname)
stg = Join(Array(vbLf,"Graph - ",g.Name,vbLf),"")
g.CopyToClipboard
Renaming a Graph
When you run this script a dialog box displays to ask you to enter the new name for the Graph.
In this example, the Graph values are read and printed in the Immediate Window. Note that the Graphs were plotted after
running Project.Simulator.Analyze. Note that your script does not step through this statement until the simulation is
complete.
After running this code, the Project Browser displays the new measurement under the corresponding graph. The name
of the new measurement complies with the standard measurement naming conventions. The YdataDim property returns
Y-dimensions of the Measurement object.
The following script plots all S-parameters in both polar and rectangular formats on four separate Graphs:
Sub Main
Dim g As Graph
schName = Project.Schematics(1).Name
Set g = Project.Graphs.Add("S11 and S22",mwGT_SmithChart)
g.Measurements.Add(schName,"S(1,1)")
g.Measurements.Add(schName,"S(2,2)")
Set g = Project.Graphs.Add("S21 and S12",mwGT_Polar)
g.Measurements.Add(schName,"S(2,1)")
g.Measurements.Add(schName,"S(1,2)")
Set g = Project.Graphs.Add("Gain and Isolation",mwGT_Rectangular)
g.Measurements.Add(schName,"DB(|S(2,10|)")
g.Measurements.Add(schName,"DB(|S(1,2)|)")
Set g = Project.Graphs.Add("Return Loss",mwGT_Rectangular)
g.Measurements.Add(schName,"DB(|S(1,1)|)")
g.Measurements.Add(schName,"DB(|S(2,2)|)")
End Sub
NOTE: You can edit measurements via the API. You can change the Name, Source, and Type properties. You can also
remove a specific measurement from the collection. The following code either returns or sets the value of the string
variable to which they correspond:
Projects.Graphs(item).Measurements(item).Type
Projects.Graphs(item).Measurements(item).Source
Projects.Graphs(item).Measurements(item).Name
Enabled = True
After disabling measurement
Enabled = False
To simulate all measurements for an individual Graph, use the following code:
res = Project.Graphs("graph1").SimulateMeasurements
Debug.Print res
This method provides simulation from the graph level. Results are False if the simulation does not occur.
To simulate individual measurements for a specific Graph, use the following code:
res = meas.SimulateMeasurement
Debug.Print res
This method allows you to simulate a single measurement. Results are False if the simulation does not occur.
You can set the DataType of the measurement object. The NI AWR SDE offers the following DataTypes (constants that
define different measurement data types):
Name Value
mwMDT_UnKnown 0
mwMDT_ReflectionData 1
mwMDT_AdmittanceData 2
mwMDT_ImpedanceData 3
mwMDT_GainCircleData 4
mwMDT_NoiseData 5
mwMDT_StabilityData 6
mwMDT_CurveTraceData 7
mwMDT_SpectrumData 8
mwMDT_SourceMapData 9
mwMDT_HistogramData 10
mwMDT_MultiTraceData 11
mwMDT_LoadPullContour 12
mwMDT_DiscreteTimeData 13
Measurement Types
The NI AWR SDE offers access to the MeasurementInfos collection of objects. This collection allows you to retrieve
all information regarding Measurement names, Types, categories, and DataUnitTypes. The following script outputs full
information:
For i = 1 To MWOffice.MeasurementInfos.Count
Next i
End Sub
For a complete description of the measurements for each Measurement Type, see Microwave Office Measurement
Catalog.
The following is an example of adding different types of Graphs and Measurements to the Project:
"Source" is the particular data source name, for example "Filter", or "All Sources"; m.Name is the MeasurementInfo.Name
.
You can output the Source, Type, and UnitType of the Measurement object.
NOTE:This technicue has some issues, see next section "Reading Graph Values"
Option Explicit
' Code Module
Sub Main
Dim g As Graph
Dim m As Measurement
Debug.Clear
For Each g In Project.Graphs
Debug.Print g.Name & ":"
For Each m In g.Measurements
Debug.Print " Meas name: " & m.Name
Debug.Print " X axis display units: " & Project.Units(m.UnitType(1)).UnitString
Debug.Print " First 5 x-axis values: "
Dim i As Integer
For i = 1 To 5
Debug.Print " " & m.XValue(i)
Next i
Next m
Next g
End Sub
S11:
Meas name: Schematic 1:DB(|S(1,1)|)
X axis display units: GHz
First 5 x-axis values:
1000000000
2000000000
3000000000
4000000000
5000000000
Vtime:
Meas name: Schematic 1:Vtime(PORT_1,1)[1]
X axis display units: ns
First 5 x-axis values:
0
1
2
3
4
The following script outputs HelpContext for all models and all Measurements in the NI AWR SDE to the modelhelp.csv
and meashelp.csv files.
Sub Main
Dim m As Model
Dim mcol As Models
Dim ms As Measurementinfo
Dim mscol As Measurementinfos
Debug.Clear
Set mcol = MWOffice.Models
Set mscol = MWOffice.Measuremantinfos
Debug.Print mcol.Count
Open "modelhelp.csv" For Output As #1
Open "meashelp.csv" For Output As #2
For Each m In mcol
If Left$(m.Name)<> "_" Then
Debug.Print m.Name;",";m.HelpContext
Print #1,m.Name; ;",";m.HelpContext
End If
Next m
Debug.Print mscol.Count
For Each ms In mscol
If Left$(ms.Name)<> "_" Then
Debug.Print ms.Name;",";ms.HelpContext
Print #1,ms.Name; ;",";ms.HelpContext
End If
Next ms
Close #1
Close #2
End Sub
Deleting Measurements
To delete all Measurements from the first Graph in a Project enter the following code:
Project.Graphs(1).Measurements.RemoveAll
To delete specific Measurements from a specified Graph, use the following example:
In the following example the results of the simulation display in the Immediate Window.
Set gs = Project.Graphs
Set g = gs.Add("New Graph",mwGT_Rectangular)
Set gt = gs.Add("Tabular",mwGT_Tabular)
Dim meas As Measurement
g.Measurements.Add("Master","DB(|S(1,1)|)")
gt.Measurements.Add("Master","DB(|S(1,1)|)")
Project.Simulator.Analyze
Set meas = Project.Graphs("New Graph").Measurements(1)cPoints = meas.XPointCount
For i=1 To cPoints
Debug.Print i;": ";meas.XValue(i);vbTab;meas.YValue(i,1)
Next i
Debug.Print "YDataDim = ";meas.YDataDim
NOTE:When developing Measurements via the NI AWR SDE, for "generated x-axis" measurements like Vtime and
Vharm, the x-data is not stored in the "X-values" because if the measurement has more than one trace (for example,
Vtime that is swept over frequency), the x-data values are different for each trace. In these cases, the X-values are just
continuous integers representing the index. The real X-values are interspersed with the Y-values.
This technicue has issues. For the following graph measurements and the script:
Sub Main
Debug.Clear
' Old way
Dim spar As Measurement, vtime As Measurement
Set spar = Project.Graphs("Spar").Measurements(1)
Set vtime = Project.Graphs("Vtime").Measurements(1)
' Let's print the x-values for both measurements
Debug.Print spar.XPointCount
For i = 1 To spar.XPointCount
Debug.Print spar.XValue(i)
Next i
Debug.Print vtime.XPointCount
For i = 1 To vtime.XPointCount
Debug.Print vtime.XValue(i) ' it prints 0 to N-1
Next i
End Sub
The x-values for the s-parameter measurement are as expected (1e9,2e9). The x-values for the time measurements are
clearly wrong, they go from 0 to #pts-1. The time measurement has two traces with different x-values for each trace. As
such, the x-data is forced to be interspersed with the y-data.
Debug.Print vtime.YDataDim
For i = 1 To vtime.YDataDim
Debug.Print vtime.YValue(501, i)
Next i
The vtime measurement has four y-data-dims. Printing the last point in the trace for each of the four dims gives us a
clue:
4
0.000000002 'Last x-val, trace1
0.201081551113916 'Last y-val, trace1
0.000000001 'Last x-val, trace2
0.201081551113916 'Last y-val, trace2
Dimensionality of data. 1 for real, 2 for complex, 4 for circles, 17 for Smap!
The number of traces in the measurement. Plotting a real measurement that has four sweep values gives a y-data-dim
of 4, but a complex measurement would be 8 if they share x-values.
For unique x-value measurements, like Vtime, the y-data-dim is 2*#traces because each trace has and x vector and a
y vector interspersed within the y-data.
We dont even see a way in the API to determine which measurements use shared vs. unique data.
Using TraceValues() - a new read-only property, for accessing the x/y values associated with a trace on a 2D graph
New TraceValues() property for accessing the x/y values associated with a trace on a 2D graph are shown in the following
code:
Sub Main
PrintAllTraces("Spar")
End Sub
Sub PrintAllTraces(graph_name As String)
Debug.Clear
Dim dv() As Double
Dim m As Measurement
Set m = Project.Graphs(graph_name).Measurements(1)
Dim trace_index As Integer
Dim nx, ny As Integer
Dim ix, iy As Integer
Debug.Print "#Traces=" & m.TraceCount
For trace_index = 1 To m.TraceCount
Debug.Print "trace" & trace_index
dv = m.TraceValues(trace_index)
nx = UBound(dv,1) 'first dimension is x-axis
ny = UBound(dv,2) 'second dimension is x/y-data
Debug.Print "#x = " & nx
Debug.Print "#y = " & ny
For iy = 1 To ny
#Traces=1
trace1
#x = 2
#y = 2
y1
x(1)=1000000000
x(2)=2000000000
y2
x(1)=0.899230342395372
x(2)=0.89923034239537
#Traces=1
trace1
#x = 2
#y = 3
y1
x(1)=1000000000
x(2)=2000000000
y2
x(1)=-0.845705590327905
x(2)=-0.845705590327905
y3
x(1)=-0.307794372485185
x(2)=-0.307794372485185
Handles shared/unique x-values.Output for Vtime (last x-point only, for brevity):
#Traces=2
trace1
#x = 501
#y = 2
y1
x(501)=0.000000002
y2
x(501)=-9.73331267194979E-02
trace2
#x = 501
#y = 2
y1
x(501)=0.000000001
y2
x(501)=-9.73331267194979E-02
Keep in mind that if a Measurement is based on a complex modifier, or if the equation Measurement does not use it
directly in the script, you use a real modifier instead. The behavior for "generated x-axis" Measurements like Vtime and
Vharm is handled automatically by Measurements, but equations cannot assume they are representing a single
Measurement.
In the following picture you can see that two sweep dimensions, four traces produced:
To get the values for Parametric Sweep Access use the following code:
Sub Main
Debug.Clear
Dim m As Measurement
Set m = Project.Graphs(1).Measurements(1)
Dim sls As SweepLabels
Dim sl As SweepLabel
For trace_index = 1 To m.TraceCount
Set sls = m.SweepLabels(trace_index)
Debug.Print "Trace " & trace_index
For Each sl In sls
Debug.Print sl.Name & "=" & sl.Value & " (" & sl.UnitType & ")"
Next sl
Next trace_index
End Sub
Sweep labels correspond with exactly what you see in the parameter markers on the previous picture.
Trace 1
R1=25 (0)
R2=10 (0)
Trace 2
R1=30 (0)
R2=10 (0)
Trace 3
R1=25 (0)
R2=20 (0)
Trace 4
R1=30 (0)
R2=20 (0)
You can use OutputEquations to assign the results of a Measurement to a variable, which can be used in other equations
like any other variable. The results computed in equations can be plotted like any other Measurement. For details see
Variables and Equations.
Debug.Print Project.ErrorState
PrintEmbeddedDetails emb
Next emb
End Sub
For i = 1 To grph.EmbeddedDesigns.Count
If (grph.EmbeddedDesigns(i).DesignName = "Graph 1") Then
index = i
End If
Next i
The following example iterates through the entire Schematics collection and Elements parameters collections. It also
outputs the values of the Optimize, Constrain, and Tune properties.
The output in the Immediate Window shows that you can access all of the properties via the API.
Schematic Name = Filter Element CAP.C2 parameter = C Optimize = True Constrain=False Tune = Tru
OptimizeYield = False StatVariation = 0 TolInPercent = False
Schematic Name = Filter Element IND.L3 parameter = L Optimize = True Constrain = FalseTu
OptimizeYield = True StatVariation=0.000000003 TolInPercent = False
You can set parameter properties (such as Optimize, or Tune, or Constrain) to "True" and select the setting in the Variable
Browser.
The following example shows how to toggle off the Optimize property in all Element parameters in the Project.
Sub Main
'Seeking for Elements and for parameters
Debug.Clear
Dim sch As Schematic
Dim ele As Element
Dim par As parameter
Dim eqn As Equation
Dim l As Long
Dim k As Long
Dim i As Long
i = 0
For Each sch In Project.Schematics
i = i + 1
l = 0
For Each ele In sch.Elements
l=l+1
If ele.parameters.Count > 0 Then
k = 0
For Each par In sch.Elements(l).parameters
k = k + 1
If par.Optimize Then
Debug.Print
Debug.Print "Schematic Name = ";Project.Schematics(i).Name;String(10," ");
"Element ";ele.Name;String(10," ");"parameter = ";par.Name
par.Optimize = False
End If
Next par
' Seeking in Equations
You can set parameter properties to Tune and do some tuning as in the following code:
End Sub
Sub Main
Dim tune As Tuner
Dim var As TuneVariable
Dim var2 As TuneVariable
If (tune.Variables.Exists(var.Name)) Then
Debug.Print "Tune variable " & var.Name & " Exists by name succeeded"
Else
Debug.Print "Tune variable " & var.Name & " Exists by name failed"
End If
Debug.Print ""
Next var
End Sub
tune.Variables("TL1:W").Maximum = 250e-6
tune.Variables("TL1:L").Maximum = 25e-6
tune.Variables("TL1:W").Nominal = 15e-6
tune.Variables("TL1:L").Nominal = 80e-6
tune.Variables("TL1:W").Minimum = 3e-6
tune.Variables("TL1:L").Minimum = 25e-6
tune.Variables("TL1:W").Step = 0.2e-6
tune.Variables("TL1:L").Step = 2e-6
tune.Restore("MyState")
Optimization
Working with Optimization Goals
You can optimize your Project via a script. For example, you can automate a complex optimization where a set of goals
is iterated through while several optimizations are performed. In the following example, five optimization goals are set
and optimized simultaneously:
From a design viewpoint this optimization sequence is not very beneficial, although it does identify the core optimization
functionality. For the optimization goals, it also demonstrates an alternative way to loop through a collection.
Dim og As Goal
' disable the group delay goal, enable others
For Each og In Project.OptGoals
If (og.MeasName = "GD[2,1]") Then
og.Enable = False
Else
og.Enable = True
End If
Next og
' setup optimizer
Project.Optimizer.Type = 6
Project.Optimizer.Iterations = 200 ' returns number of current iterations
Debug.Print Project.Optimizer.Type ' check the type of optimizer
Project.Optimizer.Start ' run optimizer
' set the optimizer type
Project.Optimizer.Type = "Random (Local)"
Debug.Print Project.Optimizer.Type
For i=1 To 10
Project.Optimizer.Iterations=5000
Project.Optimizer.Start
Wait .5
Debug.Print i;":";Project.Optimizer.Cost
Wait .5
Project.Optimizer.Save (Format(i))
Project.Optimizer.Revert ("Initial")' swap the optimization goals
Next i
The following script sets a sloped goal in which both values are different than the original values:
-3.40282346638529E+38 3.40282346638529E+38
1 1
-3.40282346638529E+38 3.40282346638529E+38
2 3
Note that in the examples, all Optimizer Goals were previously set in the Project.
Constants that define different types of optimization goals are shown in the following table:
Name Value
mwOGT_Equals 0
mwOGT_LessThan 1
mwOGT_GreaterThan 2
The following script creates a Graph with Measurements and adds two Optimizer Goals that display as subnodes of the
Optimizer Goals node in the Project Browser.
Sub Main
'Check_OptGoals
Debug.Clear
Dim gs As Graphs
Dim g As Graph
Dim gg As Graph
Dim m As Measurement
Dim og As Goal
Dim ogg As Goal
' Adding Graphs to the project
Set gs = Project.Graphs
Set g = gs.Add("Graph 1",mwGT_Rectangular)
'Creating measurements
g.Measurements.Add("Filter","|S(1,1)|")
g.Measurements.Add("Filter","|S(2,1)|") 'works
Set og = Project.OptGoals.Add("Filter","|S(1,1)|",mwOGT_LessThan,1,2,
4.8e+09,5.2e+09,mwUT_Frequency,0.3,0.3,mwUT_DB)
Set ogg= Project.OptGoals.Add("Filter","|S(2,1)|",mwOGT_GreaterThan,1.3,2,
4.8e+09,5.2e+09,mwUT_Frequency,0.97,0.97,mwUT_DB)
og.Weight = 0.06
og.xStart = -10
og.L = 0
Debug.Print "CircuitName = ";og.CircuitName;vbTab;"MeasName = ";og.MeasName
Debug.Print "Weight = ";og.Weight;vbTab;"Name = ";og.Name
Debug.Print "xStart = ";og.xStart;vbTab;"xStop = ";og.xStop
Debug.Print "yStart = ";og.yStart;vbTab;"yStop = ";og.yStop
Debug.Print "Cost = ";og.Cost;vbTab;"Enable = ";og.Enable;vbTab;"L = ";og.L
Debug.Print
Debug.Print "CircuitName = ";ogg.CircuitName;vbTab;"MeasName = ";ogg.MeasName
Debug.Print "Weight = ";ogg.Weight;vbTab;"Name = ";ogg.Name
Debug.Print "xStart = ";ogg.xStart;vbTab;"xStop = ";ogg.xStop
Debug.Print "yStart = ";ogg.yStart;vbTab;"yStop = ";ogg.yStop
Debug.Print "Cost = ";ogg.Cost;vbTab;"Enable = ";ogg.Enable;vbTab;"L = ";ogg.L
Project.Simulator.Analyze
End Sub
Also, any units types are ignored when adding Optimization/Yield Goals through the API.
mwUT_Scaler, 0, 0, mwUT_Scaler)
Project.YieldGoals.Add("Schematic 1", "DB(|S(1,1)|)", mwOGT_LessThan, -3.40282346638529E+38, 3.402
mwUT_Scaler, -10, -10, mwUT_Scaler)
Sub Main
Debug.Clear
Project.Simulator.Analyze
Debug.Print "TotalCost = ";Project.OptGoals.TotalCost
Project.Optimizer.Start
Wait 10
Project.Optimizer.Stop
Debug.Print "Optimizer.Cost = ";Project.Optimizer.Cost
End Sub
TotalCost = 4.22384419132002E-02
Optimizer.Cost = 4.21570201565972E-02
You can print out all Opt Goal details using the following script:
Sub Main
Debug.Clear
Dim objGoal As Goal
If Project.OptGoals.Exists(objGoal.Name) Then
Debug.Print "Lookup Exists by Name Succeded"
Else
Debug.Print "Lookup Exists by Name Failed"
End If
Project.OptGoals.Remove(1)
To access to the optimizer goal measurement objects use the folowing code. The code simply shows access to the
measurement name, source, type and enabled state:
Sub Main
Dim objGoal As Goal
For the Yield Goals use the same code, but use Project.YieldGoals collection of objects
The Goal CircuitName and MeasurementName properties are writable. The following is a fragment of the code:
Set gs = Project.Graphs
writeLog(vbNewLine + vbNewLine + "Measurements" + vbNewLine)
For Each g In gs
Set ms = g.Measurements
For Each m In ms
End If
End If
End If
Next yld
scriptEnd()
Optimization Methods
The following script demonstrates how to output all Optimization Methods in the NI AWR SDE:
During a developing process it could be a change in the order in which the optimizer objects are produced. The key for
this is that the optimizer properties are accessible through the API and there doesn't seem to be a problem with accessing
the properties just a change in the order.
You can set the value, which specifies the type of Optimizer.
Project.Optimizer.Type=8
Debug.Print "Optimizer.Type =";Project.Optimizer.Type
Optimizer.Type = 8
NOTE! Project.Optimizer.Type numbers are different; older scripts may not function as expected. This script sets different
numbers for optimizers in versions 9.06 and 10:
The workaround is to specify optimizers by name (use a commented line instead). Existing scripts set a different optimizer
than expected. This is not an error; you should never reference these by index because the order may change and new
optimizers may be added. Always reference them by name as shown in the following example code:
Project.Optimizer.Type=find_opt_type("Simplex Optimizer")
Function find_opt_type(nm As String) As Integer
Dim typ As Integer
typ = -1
For i = 1 To Project.Optimizer.TypeCount
If nm = Project.Optimizer.TypeName(i) Then
typ = i
End If
Next i
If typ = -1 Then
MsgBox ("could not find optimizer name specified:" & nm)
End If
find_opt_type = typ
End Function
The following script queries the properties of a couple of basic optimizer types we expect to be included in the system.
(Random and Gradient) and prints the properties for these optimizers:
End Sub
The following script demonstrates how to to get settings stored in the User ini file:
{0, 0, 0}, {1, 1, 102}, {1, 2, 71}, {1, 3, 47}, {1, 4, 62}, {1, 5, 27}, {1, 6, 58}, {1, 7, 59}, {1
Yield Analysis
Setting Statistical Properties
To set the statistical properties for an Element, use the following code:
If UseStatistics is not selected (set to "False") the statistical properties are ignored during a yield optimization.
Set the OptimizeYield property to "True" to allow modification of the nominal value of the parameter during a yield
optimization. If the parameter value is also constrained (the Constrain property is set to "True"), then the yield optimizer
uses UpperConstraint and LowConstraint properties to ensure that the nominal value is not changed to an unacceptable
value. You can also set the StatVariation and Distribution properties.
Constants that define different types of yield goals are shown in the following table.
Name Value
mwYGT_LessThan 0
mwYGT_GreaterThan 1
The following script creates Yield Goals displaying as subnodes of the Yield Goals node in the Project Browser.
Sub Main
'Check_Yield.bas
Debug.Clear
Dim gs As Graphs
Dim g As Graph
Dim m As Measurement
Dim yg As YieldGoals
' Adding Graphs to the project
Set gs = Project.Graphs
Set g = gs.Add("Graph 1",mwGT_Rectangular)
'Adding measurement to the Graph
g.Measurements.Add("MCLIN","|S(2,1)|")
Set yg = Project.YieldGoals
yg.Add("MCLIN","|S(2,1)|",mwYGT_GreaterThan,1e9,10e9,mwUT_Frequency,0.3,0.3,mwUT_None)
yg.Item(1).L = 2
Debug.Print "CircuitName = ";yg.Item(1).CircuitName;vbTab;"MeasName = ";
yg.Item(1).MeasName
Debug.Print "Weight = ";yg.Item(1).Weight;vbTab;"Name = ";yg.Item(1).Name
Debug.Print "xStart = ";yg.Item(1).xStart;vbTab;"xStop = ";yg.Item(1).xStop
Debug.Print "yStart = ";yg.Item(1).yStart;vbTab;"yStop = ";yg.Item(1).yStop
Debug.Print "Cost = ";yg.Item(1).Cost;vbTab;"Enable = ";
yg.Item(1).Enable;vbTab;"L = ";yg.Item(1).L
Debug.Print
Project.YieldAnalyser.Start
Wait 10
Project. YieldAnalyser.Stop
We added a continue method to the Project.YieldAnalzyer interface which appears to perform the same operations as if
the continue button was pressed on the Yield Analysis dialog. In the following code the yield iterations begin to count
up, then pause, and then continue from that point onward. We can get graphs to display updates when the ShowAllUpdates
flag is set. Setting the ShowAllUpdates in the optimizer is supposed to provide feedback in the graph views on the
simulation progress and this makes this option work with yield as well as optimization:
The following script finds Yield type before performing Yield Analysis:
Sub Main
MWOffice.Project.YieldAnalyzer.NewWindow
Project.YieldAnalyzer.MaxIterations=8
Project.YieldAnalyzer.Type=find_yield_type("Yield Analysis")
Project.YieldAnalyzer.MaxIterations=10
Project.YieldAnalyzer.Start
End Sub
Function find_yield_type(nm As String) As Integer
Dim typ As Integer
typ = -1
For i = 1 To Project.YieldAnalyzer.TypeCount
If nm = Project.YieldAnalyzer.TypeName(i) Then
typ = i
End If
Next i
If typ = -1 Then
MsgBox ("could not find yield analyzer name specified:" & nm)
End If
find_yield_type = typ
End Function
NOTE: To see graph updates, display the Yield Analyzer window before starting the Yield Analysis.
MWOffice.Project.YieldAnalyzer.NewWindow
MWOffice.Project.YieldAnalyzer.Start
API has read-only property for accessing the Yield Goal Type. If you want to change the type, you'll need to delete and
then add a new goal. To access the type use the following code:
For i =1 To Project.YieldGoals.Count
Debug.Print Project.YieldGoals(i).Type
Next i
The property returns the type of the Yield Goal (>, <, =)
API provides equivalent of the Yield Analysis Continue button on the optimizer. To support Continue method for
optimizer in API we need to initialize the graphics to display cached yield traces in the graphs if the optimizer has been
set into the Show All Updates mode. Setting the ShowAllUpdates in the optimizer is supposed to provide feedback in
the graph views on the simulation progress and this makes this option work with yield as well as optimization. You need
to open the Yeild window and run the following program. The yield iterations will begin to count up, then pause and
then continue from that point onward:
DataSets
Working with the DataSets Collection
Graph data sets allow you to store all data on the active graphs for a project. You can automatically save this data when
closing a project, and restore the data when reopening the project. The reopened project displays the data from the last
simulation.
To work with the DataSets collections you need to use the DataSetFolders collection of objects.
With the Project.DataSetFolders(1).TreeNode object you can Expand and Collapse the node, and Select and make the
TreeNode object visible.
There are DataSet properties and methods. You can pin and unpin the DataSet object, and give it a new name. You can
also Import a DataSet object.
The following script adds Output Equations and Measurements pointing to older DataSets, and plots on Graph:
Dim gr As Graph
Dim meas As Measurement
Dim oeqndoc As OutputEquationDocument
Debug.Clear
Set oeqndoc = Project.OutputEquationDocuments(1)
oeqndoc.Equations.Add("old_oe = em1.@EM_Sim_DS0:S(1,1)",0,200)
Set gr = Project.Graphs("Older_DS")
gr.Measurements.Add("em1.@EM_Sim_DS0","S(1,1)")
gr.Measurements.Add("Output Equations","Eqn(old_oe)")
End Sub
dset.Name = "CurrentDS
End Sub
End Sub
The following script finds the number of Data Sets created in a Project:
cnt = 0
tks = Split(Project.Name,".")
pth = Project.Path & "DATA_SETS\" & tks(0) & "\"
Debug.Print pth
Set objFolder = objFileSystem.GetFolder(pth)
For Each objFile In objFolder.Files
Debug.Print objFile.Name
If InStr(objFile.Name,".dsf") Then
cnt = cnt +1
End If
Next objFile
num_data_sets=cnt
End Function
The following script created two Data Sets and pins the old Data Sets:
'Pin old ds
Set dsetfs = Project.DataSetFolders
Set dset = dsetfs("em2").DataSets("EM_Sim_DS0")
dset.Pin
End Sub
The following script Imports Data Sets and Updates the Clock:
Dim ds As DataSet
Dim fPath As String
End Sub
The Import command returns a Dataset object (the one that was just imported). For the script to run successfully the
Project and Dataset should be in the same directory.
Project.Optimizer.Type=find_opt_type("Simplex Optimizer")
'Project.Optimizer.StopAtMin=True
Project.Optimizer.Start
End Sub
Function find_opt_type(nm As String) As Integer
Dim typ As Integer
typ = -1
For i = 1 To Project.Optimizer.TypeCount
If nm = Project.Optimizer.TypeName(i) Then
typ = i
End If
Next i
If typ = -1 Then
MsgBox ("could not find optimizer name specified:" & nm)
End If
find_opt_type = typ
End Function
Set gr = Project.Graphs("Older_DS")
gr.Measurements.Add("em1.@"&dsname,"S(1,1)")
End Sub
Function get_current_data_set(folder As String) As String
'returns a comma separated list of names of current data sets in folder provided. If no current w
Dim ds As DataSet
Dim ans As String
ans = ""
If Project.DataSetFolders.Exists(folder) = False Then
ans = "no_folder"
Else
Dim fn As String
Dim measn As String
'import 2nd data set w/diff response - it should get automatically renamed
fn = Project.Path + "import_em_sim_ds.DS0.dsf"
Set dset = Project.DataSetFolders.Import(fn)
dset.Name = "CurrentDS"
Dim gr As Graph
Next ele
Project.Simulator.Analyze
End Sub
Function graph_to_dfile(gr As Graph)
xcnt = 0
dfname = "df_" + gr.Name
End If
Next gr
End Function
Project.YieldAnalyzer.MaxIterations = 6
Project.YieldAnalyzer.Start
End Sub
typ = -1
For i = 1 To Project.YieldAnalyzer.TypeCount
If nm = Project.YieldAnalyzer.TypeName(i) Then
typ = i
End If
Next i
If typ = -1 Then
MsgBox ("could not find yield analyzer name specified:" & nm)
End If
find_yield_type = typ
End Function
Accessing information provided by the data set dialog for the SimInfo and SimLogInfo
pages.
API has basic access to the information provided by the data set dialog for the SimInfo and SimLogInfo pages. The
information provided in these dialog is just string information extracted from the log so the output values from the API
are just string values.
Output example:
Folder = EM Structure 1
Sim Info:
Document Name - EM Structure 1
Mesh Freq = 2 GHz
# of Facets = 495
# of Unknowns = 944
# of Nets = 1
# of Ports = 2
As we mentioned before, the information provided in the dialog is just string information extracted from the log. If you
want to extract actual numeric values they will need to be parsed from the API returned string. Simple example parsing
script:
retVal = -1.0
pos = InStr(1, info, target)
If (pos > 0) Then
pos2 = InStr(pos, info, vbLf)
GetSimValue = retVal
End Function
Keep in mind that The DataSet.Properties collection returns a child object of type DataSetProperty rather than type
Property. That should provide the correct type to match the child elements.So youll need to dimension it as:
bError = False
For Each dsf In Project.DataSetFolders
Debug.Print "Folder = " & dsf.Name
For Each ds In dsf.DataSets
For Each dsp In ds.Properties
Next ds
Next dsf
One more example of using the DataSets Properties in the following code:
Debug.Clear
Output example:
NumbPorts 2
SimType 7
AWRCorp Version Info 12.0.7408.7
Computer Name MARIYETTA-DT
User Name mdaylis
Operating System Microsoft Windows 7 Business Edition, 64-bit Service Pack 1 (build 7601)
Processor Information architecture:9, level:6, model:60, stepping:3, processors:8
Available Memory (MB) 15.9410705566406
bError = False
For Each dsf In Project.DataSetFolders
Debug.Print "Folder = " & dsf.Name
For Each ds In dsf.DataSets
For Each dsp In ds.Properties
Debug.Print dsp.Name & " = " & dsp.Value
Next dsp
Next ds
Next dsf
End Sub
bError = False
For Each dsf In Project.DataSetFolders
Debug.Print "Folder = " & dsf.Name
Output example:
Folder = EM Structure 1
Is Partial Data Set = False
For Optimization = False
For Tuning = False
For Yield = False
Incomplete Data Set = False
Includes 3D Model = False
Includes Geometry = True
In Memory Data Set = False
Mesh Only = False
Disable Auto Delete = False
All properties looked up successfully
The DataSet.Flags property is a parameterized property which means that it takes an argument to specify which flag the
property should represent. For example the property can be used as follows to check if a data set is partial or complete
using the mwDSF_IsPartialDataSet as an argument for the flags property:
Debug.Clear
For Each dsf In Project.DataSetFolders
For Each ds In dsf.DataSets
Debug.Print ds.Name
If (ds.Flags(mwDSF_IsPartialDataSet)) Then
Debug.Print " Partial Data Set"
Else
Accessing SubDataSets
We provide a property on the DataSet object for accessing children of the data set as a DataSet collection.
SubDataSets method to the DataSet object allows access to the children of a data set and will list the data sets and then
associated with each the sub data sets for that data set. The structure is now recursive so that if any sub data sets have
children they should be accessible as well. For example in the following code:
Debug.Clear
Debug.Print Project.DataSetFolders(1).DataSets.Count
For Each ds In Project.DataSetFolders(1).DataSets
Debug.Print ds.Name
Debug.Print ds.Filename
For Each sds In ds.SubDataSets
Debug.Print " " & sds.Name
Debug.Print " " & sds.Filename
Next sds
Next ds
End Sub
The script will list the data sets and then associated with each the sub data sets for that data set. The structure is now
recursive so that if any sub data sets have children they should be accessible as well.
Layout
Layout as Another View of the Schematic
Layout View and Schematic View are two different views of the same database. To get reference to a Layout object,
you must first get reference to the Schematic object.
The following example is a simple script demonstrating that the Schematic and Layout have the same name.
Dim s As Schematic
Dim l As Layout
For Each s In Project.Schematics
Debug.Print "Schematic Name = ";s.Name;vbTab;"Layout Name = ";
s.Layout.Name
Next s
End Sub
Layout Particulars
Drawing Objects
A Layout object consists of Drawing objects. Each Drawing object points back to the Schematic Element it represents
(if one exists), to the cell, which implements it (if one exists), and to the Shapes of which it consists. From the Shapes,
you can find the type of Shape, the Layer, and other Shape information.
The following example shows how to get the Shapes type from the Drawing Object:
Port
Port
Polygon
Polygon
Port
Port
Port
Polygon
Polygon
The following is the full script that gets the DrawingObject Type string:
Debug.Print sch.Layout.DrawingObjects.Count
Dim a As Attribute, d As DrawingObject
GetDwgObjTypeString = ts
End Function
API has access to the array attributes added to Artwork cells and disassociated PCell objects. Here is the example of the
code for layout mosaic artwork cell attributes:
If a Project has an EM document with Ports and a Schematic, and the EM document is placed in the Schematic as a
Subcircuit, and you need to know the CellPort Faces coordinates, you can use the following code. This code creates Cells
from the Layout and navigates through the faces coordinates:
Dim cl As CellLibrary
Dim lay As Layout
Dim objDraw As DrawingObject
Dim objShape As Shape
Dim vtx As Vertex
Dim objFace As Face
Dim cel As Cell
pth = Project.Path
Set cl = Project.CellLibraries(1)
For Each cl In Project.CellLibraries
For Each cel In cl.Cells
Debug.Print cl.Name;vbTab;cel.Name
Debug.Clear
Next cel
Next cl
Debug.Print schem.Name
Next objShape
Next objDraw
The following script navigates through all APLAC elements and prints the connect type if the element is a port or a pin.
Set s = Project.Schematics(1)
Set l = Project.Schematics(1).Layout
MTAPER.MT1
Connect Type: 100
Connect Type: 100
MTAPER$.MT1
MTRACE2.X1
Connect Type: 100
Connect Type: 100
PC1LIN.TL1
Connect Type: 100
Connect Type: 100
SIGCMOS.TL1
_MLEFX_T.MO1
ABRIDGE.TL1
MDRSTUB2.ST1
Connect Type: 200
Connect Type: 200
MGAP2.TL1
Connect Type: 0
Connect Type: 0
MGAP2$.TL1
MGAPX.TL1
Connect Type: 0
Connect Type: 0
MGAPX$.TL1
MOPEN.TL1
Connect Type: 0
The following script navigates through attributes and prints out the connect type info of gds cell.
Option Explicit
Sub Main
Debug.Clear
Dim c As Cell, cl As CellLibrary
Set cl = Project.CellLibraries(1)
Set c= cl.Cells(1)
Dim s As Shape, a As Attribute
2, Metal1
LayerIndex = 26
Area = 0.000000000276
2, Metal1
LayerIndex = 26
Area = 0.000000000276
2, NiCr
LayerIndex = 27
Area = 0.000000004
2, Default
PortNumber = 1
ConnectType = 7
2, Default
PortNumber = 2
ConnectType = 7
The Shape objects have a Vertices collection that includes a PolyVertices collection that provides access to the outline
points of the Paths and other polygon Shapes. This provides a method for API users to easily get the results from
Path-to-Polygon conversions. It also provides a method for getting points to use in overlap and connectivity checking,
as shown in the following script:
Debug.Clear
Next objShape
Next objDraw
End Sub
Vertexes:
P[1] = {-283, -93}
P[2] = {135, -93}
P[3] = {135, 164}
P[4] = {403, 164}
PolyVertices:
P[1] = {-303, -113}
P[2] = {155, -113}
P[3] = {155, 144}
P[4] = {423, 144}
P[5] = {423, 184}
P[6] = {115, 184}
P[7] = {115, -73}
P[8] = {-303, -73}
Accessing Hierarchical Path Information for Shapes Produced from Drawing Objects
To get all of the drawing primitives ("Shapes") required to reproduce a Layout, you iterate through the Drawing Objects
associated with the Layout, and for each of these, iterate through the Shapes that form them. NI AWR has a method
whereby Shape objects with hierarchy return the hierarchical Path to the Element with the pCell that created the Shape.
The following script prints the hierarchical Path property for Shape Objects produced from PCells. This works for
Subcircuits, and for Subcircuits that are parameterized. API provides a hierarchical path for both PCells and Shapes that
come from a Subcircuit. The Shapes will have the Subcircuit object and vector instance number as the path and for those
there as PCells will have the full path to the PCell object in its parent document and its vector instance number. For
example: Schematic 1:SUBCKT.S2,0/EM Structure 1 (AXIEM - Async):MLIN.TL1,0 Schematic 1:SUBCKT.S2,0
indicates that SUBCKT.S2 has two shapes one that is a dump shape that comes directly from the Subcircuit and one that
is provided from a PCell MLIN.TL1 inside the EM Structure 1 document. Dumb shapes down in subcircuits will now
provide the path to the subcircuit as their hier path:
Debug.Clear
Set lay = Project.Schematics("top").Layout
For Each objDraw In lay.DrawingObjects
For Each shp In objDraw.Shapes
If (shp.Type ne 6) Then
Debug.Print "Shape, Type = " & shp.Type & ", Path = " & shp.HierarchicalPath
End If
Next shp
Next objDraw
End Sub
API offers access two methods for getting the hierarchical path from pCell derived shapes from drawing objects. In the
first method paths are accessible when the shapes come from a drawing object directly and in the second method
hierarchical path are accessible from a layout snap shot:
Debug.Clear
Set lay = Project.Schematics("top").Layout
Set snap = lay.CreateSnapshot
Because a Drawing object may consist of several shapes that you cannot individually modify, changes are not allowed
to affect the original object. For example, a Path on the Plated Metal line type may consist of three different paths with
different widths drawn over each other. The system does not allow you to edit the three paths individually, but you can
edit the overall Path object. Many of the same attributes are available at the DrawingObject level, so you can modify
them there and they affect the original object.
The following script changes the attributes at the DrawingObject. The values for the Path and the Path box change when
these attributes change:
lay.Refresh
Debug.Print "TopRight Corner: ("; Project.Schematics(1).Layout.Boundary.Right; ",";Project.Schemat
Debug.Print "BottomLeft Corner: ("; Project.Schematics(1).Layout.Boundary.Left; ",";Project.Schema
Next atr
Next dro
lay.Refresh
Debug.Print dro.TypeBits;vbTab;atr.Value;vbTab;atr.ValueAsString
End If
Next atr
Next dro
lay.Refresh
End Sub
PathWriter interface added to provide an efficient means for adding large numbers of paths associated with PCB data.
We use a method to create a record object from DrawingObjects collection and then a method for creating the path with
that record object.
The following script is adding multiple paths using the PathWriter and PathRecord interfaces:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
AddPaths(lay)
End Sub
End Sub
pathRec.PathBegin(x, y)
x = x + 100e-6
pathRec.AddSegment(x, y)
y = y + 100e-6
pathRec.AddSegment(x, y)
x = x + 100e-6
pathRec.AddSegment(x, y)
pathRec.PathEnd
End Sub
Debug.Print title
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
PrintSubObjectsState(drawingObj.SubObjects)
End Sub
End Sub
Creating the standalone route objects without the associated physical nets
In some cases where we want path objects which support different line types, different widths, or curved bends and one
solution for this has been to allow them to create iNet Route objects which are stand-alone and don't have to be associated
with a physical net. We've supported this in EM, because in general there often isn't a logical schematic to form the
electrical and physical nets there but iNet routes can be useful. For certain cases we've also added support in the normal
layout editor for drawing iNet route objects that can be standalone.
The following script shows an API method for adding standalone route objects to layout via the drawing objects collection.
The code fills out a route record and then adds a route with 5 segments and two vias to the layout:
AddRouteObject(lay)
End Sub
Dim y2 As Double
Dim lt As Integer
x1 = x2
y1 = y2
y2 = y2 + 100e-6
x1 = x2
y1 = y2
x2 = x2 + 100e-6
lt = 2
x1 = x2
y1 = y2
y2 = y2 - 100e-6
lt = 0
x1 = x2
y1 = y2
x2 = x2 + 100e-6
lay.DrawingObjects.AddRoute(rtRec)
End Sub
x1 = fltLine.Begin.x
y1 = fltLine.Begin.y
x2 = fltLine.End.x
y2 = fltLine.End.y
w = 20e-6
rtRec.AddSegment(x1, y1, xMid, y1, w, 0, mwEST_TruncateEndStyle, 0, mwEST_ExtendedEndStyle, w/2)
rtRec.AddSegment(xMid, y1, xMid, y2, w, 2, mwEST_ExtendedEndStyle, w/2, mwEST_ExtendedEndStyle, w/
rtRec.AddSegment(xMid, y2, x2, y2, w, 0, mwEST_ExtendedEndStyle, w/2, mwEST_TruncateEndStyle, 0)
physNet.Routes.AddRoute(rtRec)
End Sub
Debug.Print title
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
Route Count = 1
Associated = True
Bend Style = 0
Boundary = Left = -0.00014, Top = 0.000095, Right = -0.000036, Bottom = 0.000016
Continuous = True
Custom Seg Ends = False
Global = False
Length = 0.000222
Miter Amount = 1
Miter Amount Abs = False
NetId = 3
Selected = False
Status = 0
Topology = 0
Via Cell Name = MMICROUTEVIA*
Segment Count = 5
Segments:
Begin Point = { x = -0.00014, y = 0.000026 }
Begin Point = { x = -0.00011, y = 0.000026 }
Begin Extent = 0.00001
End Extent = 0.00001
Begin Style = 0
End Style = 1
Begin Offset Style = 2
End Offset Style = 0
Line Type = 0
Selected = False
Width = 0.00002
Shape Count = 1
Segment Shapes:
Shape Type = 1
Drawing Layer = 12
----------
Begin Point = { x = -0.00011, y = 0.000026 }
Begin Point = { x = -0.00011, y = 0.000085 }
Begin Extent = 0.00001
End Extent = 0.00001
Begin Style = 1
End Style = 1
Begin Offset Style = 0
End Offset Style = 0
Line Type = 0
Selected = False
Width = 0.00002
Shape Count = 1
Segment Shapes:
Shape Type = 1
Drawing Layer = 12
----------
This script uses the DrawingObject.Shape.Vertices method to get the list of vertices through the API:
Debug.Clear
Set ob = Project.Schematics(1).Layout.DrawingObjects(1)
Set sh = ob.Shapes(1)
For Each vert In sh.Vertices
Debug.Print vert.x*1e6;",";vert.y*1e6
Next vert
End Sub
(0,0)
(10,0)
(10,5)
lay.DrawingObjects.AddDimensionLine(1e-6,1e-6,20e-6,1e-6,25e-6,1e-6,2e-6,mwDTL_CenterPar,mwDAL_Out
lay.DrawingObjects.AddDrillHole(1e-6,1e-6,"Default")
lay.DrawingObjects.AddEllipse(1e-6,1e-6,10e-6,6e-6,"Mesa")
pnts(5) = 300e-6
pnts(6) = 450e-6
pnts(7) = 250e-6
lay.DrawingObjects.AddPath(pnts,10e-6,mwPET_ExtendedHalfWidth,mwPMT_Square,1e-6,"Mesa",False)
lay.DrawingObjects.AddRectangle(1e-6,1e-6,5e-6,5e-6,"Mesa")
lay.DrawingObjects.AddLayoutRuler(0,1e-6,100e-6,1e-6,1e-6,15e-6,mwLRT_AboveRuler,1,3e-5,False,"Ari
lay.DrawingObjects.AddText(1e-6,1e-6,3e-6,"Text",0,False,"",False,False,True,"Mesa")
The following is a more complex example of adding shapes contained artwork cell and overlapped by a region or shape
like in the following picture:
capBottom = 7
The script shows API support for selecting objects in a region defined by a polygon of xy points and by referencing
another shape to define the region.
Project.Schematics(SchIndex).Layout.DrawingObjects.AddText(i*deltax, j*deltay,1e-4,text2,)
Next j
Next i
End Sub
The Alignment option might be the opposite of what you expect - it is the location of the origin relative to where the text
draws. So for the 'BottomLeft' option, the text actually draws to the upper right of the origin. This may seem unusual,
but when you test NI AWR's exported GDS in another viewer, it draws the same way.
To access a name returned for the Layer of the Drawing object, use the following script:
To change a Shapes drawing layer, previously we had to use the following code:
The most complicated part of this code is determining the layer index from the Name:
Now we support getting and setting the drawing layer for shapes via the attributes directly using the layer name. With
this support the same thing can be performed as following:
This removes the complicated step of looking up the layer index and allows the layer name to be used directly via layer
name attribute.
API has access to the description field of the drawing layers. These provide read/write property on the drawing layer
object in the API so that values can be set and retrieved for each drawing layer object. A string field to the drawing layer
information structure can be used for extended descriptions of the purpose of the layer.
To access Polyline shapes from a Drawing object, use the following code:
Debug.Clear
Set ob = Project.Schematics(1).Layout.DrawingObjects(1)
Set sh = ob.Shapes(1)
For Each vert In sh.Vertices
Debug.Print vert.x*1e6;",";vert.y*1e6
Next vert
End Sub
Dim e As Element
Set e = Project.Schematics(2).Elements(1)
Dim lp As Layoutparameter
Set lp = e.DrawingObjects(1).parameters(1)
Debug.Print lp.Name
The following example script determines what kind of DrawingObject by type bits:
Dim dr As DrawingObject
End Sub
mwOSF_Graphics = 0x1,
mwOSF_Equation = 0x2,
mwOSF_Text = 0x4,
mwOSF_CommonElement = 0x8,
mwOSF_Wire = 0x10,
mwOSF_Annotation = 0x20,
mwOSF_iNet = 0x40,
mwOSF_MovableProbe = 0x80,
mwOSF_LayCell = 0x100,
mwOSF_SubCell = 0x200,
mwOSF_ParamFrame = 0x400,
mwOSF_BySize = 0x800,
mwOSF_CellPort = 0x1000,
mwOSF_AreaPin = 0x2000,
mwOSF_LayPort = 0x4000,
mwOSF_ByPositionFixed = 0x8000,
mwOSF_BySize2 = 0x10000,
mwOSF_ArtworkCell = 0x20000,
mwOSF_PinObject = mwOSF_CellPort | mwOSF_LayPort | mwOSF_AreaPin,
mwOSF_InstObject = mwOSF_LayCell | mwOSF_SubCell
};
The following example script defines the base position of the Drawing object:
Debug.Print Left$(Str,i-1)
Debug.Print s2
Set sCol = p.Schematics
Set s = sCol.ActiveSchematic
Debug.Print "schematic Name : ;s.Name
Set l = s.Layout
Debug.Print "layout Name : ";l.Name
Dim x As Double
Dim y As Double
For Each d In l.DrawingObjects
If d.Selected Then
Debug.Print d.Flipped
Set vtx = d.BasePosition
x = vtx.x
y = vtx.y
d.Flipped = Not d.Flipped
d.RotationAngle = d.RotationAngle + 180.0
Debug.Print d.BasePosition.x;",";d.BasePosition.y
d.BasePosition.x = x
d.BasePosition.y = y
Debug.Print "drawing object Base Position. x = ";d.BasePosition.x;",";"drawing object Base Posit
End If
Next d
s.Activate
wlayout.Activate
End Sub
NOTE: Drawing objects x, y argument values can depend on what methods you use. For example, if you use Copy and
Paste in the API it should function the same as the Copy and Paste commands from the UI, where the x and y values are
the absolute x and y values where you want to place the Copy of the object. This is consistent with the Paste command,
which also takes x and y values where you want to paste the Shapes. The easiest way to do a relative offset is to get the
base position of the Shape you are copying and offset relative to that base position to get an absolute x and y value. The
values you give for x and y are the new base position for the copied object. The following script is an example of
performing the copy using absolute rather than relative coordinate values. The script moves each of the Shapes relative
to their location.
The script moves all Shapes to x=5um, y=0um. All Shapes have the same base position after the Copy.
The Layout object has a SelectedObjects property that returns a collection of the DrawingObject(s) selected in Layout.
Enumerating this collection allows you to traverse just the objects in the select list of the document. The drawing objects
are contained in an ISelectedDrawingObjects collection that provides methods for Adding Drawing objects to the selected
collection, Removing an object from the selected collection, or Removing all objects from the selected collection.
The following script moves all cells so that they fit the bottom-right of the layout to (0,0):
Sub Main
Debug.Clear
SC = Project.Schematics.Count
For i=1 To SC
SN = Project.Schematics(i).Name
BL = Project.Schematics(i).Layout.Boundary.Left
BB = Project.Schematics(i).Layout.Boundary.Bottom
DC = Project.Schematics(i).Layout.DrawingObjects.Count
For l=1 To DC
Fcheck = Project.Schematics(i).Layout.DrawingObjects(l).Frozen
If Fcheck = True Then
Project.Schematics(i).Layout.DrawingObjects(l).Frozen = False
Project.Schematics(i).Layout.DrawingObjects(l).Move (-BL,-BB)
Project.Schematics(i).Layout.DrawingObjects(l).Frozen = True
Else
Project.Schematics(i).Layout.DrawingObjects(l).Move (-BL,-BB)
End If
Next l
Next i
End Sub
The following script moves all Objects in Layout with a different approach:
Project.Schematics(1).Layout.SelectedObjects.AddAll
Debug.Print lay.SelectedObjects.Count
lay.InvokeCommand("EditorGroup")
We improved the argument support in the two point move command so that in addition to the basic move offset operations
we can make angle and flip moves as well. We added a second set of arguments that can be provided with move of two
point move operations. Rather than just dx and dy, the command can take x1, y1, x2, y2, rotCCW, flip which allows x1
y1 to be used as a reference point for the move operations and for rotation and flip operations on the objects being
moved.We can now pass angle in degrees rather than radians for rotate selected objects call and ensure the command
member data is updated with the values extracted from the arguments.
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditMove", Array(200e-6, 200e-6))
The following code helps to find the position of the mouse pointer in the schematic layout window, when the script is
run (using a hotkey). After that the script could resize/reshape a polygon, and the mouse position would determine which
vertex to modify since we don't have the ability to select vertices in our environment except when using the shape
stretcher. API provides access to cursor position information associated with a view. The values that we return from the
API are rounded the database grid for layout. We also provide access to the hit info structure held by the view for most
design diagrams and graphs. The diagrams give the X and Y location as well as information regarding the state of the
control and shift keys when the information was recorded.
The following script shows an example API access to cursor position in layout window:
Debug.Clear
Next vw
End Sub
Position X = 10.5
Position X = 35.23
Control Dn = False
Shift Down = False
The following script shows an example of adding text with font arguments to artwork cells:
In the previous script, the API supports adding Polygon text directly to GDS cells. This method takes the text to be added
and converts it to Polygons, and then adds the resulting polygons to the GDSII. This is necessary because GDSII does
not directly support Polygon text.
'text angles can only be 0,90,180,and 270 so far, and it doesn't handle flipped text.
Sub Main
Debug.Clear
Dim sx As Schematic
Dim DrawObj As DrawingObject
Dim shp As Shape
Dim attr As Attribute
Dim vtx As Vertex
Dim i As Integer
Dim sch() As String
Dim dlayers() As String
Dim des_name() As String
Dim des_cnt() As Integer
'Define some global variables
'fntsize_mil = 4
fntsize_mm = 0.1
'fntsize_m = fntsize_mil*0.0000254
fntsize_m = fntsize_mm*0.001
dtext = "XXXX"
dtextlen = Len(dtext)
'make a list of all Schematic names
schnum= Project.Schematics.Count
ReDim sch(schnum)
For i = 1 To schnum
sch(i) = Project.Schematics(i).Name
Next i
'chose schematic as reference to layout
Begin Dialog UserDialog 400,300 ' %GRID:10,7,1,1
ListBox 60,42,270,200,sch(),.ListBox1
Text 70,21,240,14,"Select Schematic Layout to Generate
Designators",.Text1
OKButton 150,260,100,28
'CancelButton 225,260,100,28
End Dialog
Dim dlg As UserDialog
Dialog dlg
schIndex = dlg.ListBox1 + 1
'make list of all drawinglayers
lyrnum= Project.LayerSetup.DrawingLayers.Count
ReDim dlayers(lyrnum)
For i = 1 To lyrnum
dlayers(i) = Project.LayerSetup.DrawingLayers(i).Name
Next i
'chose drawing layer for designators
Begin Dialog UserDialog 400,300 ' %GRID:10,7,1,1
ListBox 60,42,270,200,dlayers(),.ListBox1
Text 70,21,240,14,"Select Drawing Layer for Designators",.Text1
OKButton 150,260,100,28
'CancelButton 225,260,100,28
End Dialog
Dim dlg1 As UserDialog
Dialog dlg1
dlayerIndex = dlg1.ListBox1 + 1
deslayer = dlayers(dlayerIndex)
'can get units from layout and multiply vertices by multiplier to give proper units
'umult = Project.Units(mwUT_Length).MultValue
'uname = Project.Units(mwUT_Length).UnitString
ReDim des_name(0)
des_name(0) = ""
ReDim des_cnt(0)
des_cnt(0) = 0
c_index = 0
Set sx = Project.Schematics(sch(schIndex))
Debug.Print "Schematic Name = " & sx.Name
For Each DrawObj In sx.Layout.DrawingObjects
Debug.Print " "
For Each shp In DrawObj.Shapes
If shp.Type = mwST_Text Then
'Debug.Print "Shape Type = Text"
txt= shp.Attributes(2)
If Right(txt,dtextlen) =dtext Then
Debug.Print txt
'here need to figure out what kind it is, if not new, update index, if new, and
'below need to be smart with text
'if have CXXX, first one should be C001, not C1
nw = next_val(des_name,txt,des_cnt,dtext)
'don't have a generic way of doing this now, only 0,90,180,270 degrees
angle = Round((DrawObj.RotationAngle)*180/3.1415927)
Debug.Print "Angle ";angle
'0 angle case
If angle >= -45 Then
If angle < 45 Then
y = shp.Boundary.Bottom
Debug.Print "y origin ";yx = shp.Boundary.Left
Debug.Print "x origin ";x
End If
End If
'90 degree angle case
If angle >= 45 Then
If angle < 135 Then
y = shp.Boundary.Bottom
Debug.Print "y origin ";y
x = shp.Boundary.Right
Debug.Print "x origin ";x
End If
End If
'-90 degree angle case
If angle <= -45 Then
If angle > -135 Then
y = shp.Boundary.Top
Debug.Print "y origin ";y
x = shp.Boundary.Left
Debug.Print "x origin ";x
End If
End If
'-180degree angle case
If angle <= -135 Then
y = shp.Boundary.Top
Debug.Print "y origin ";y
x = shp.Boundary.Right
Debug.Print "x origin ";x
End If
If angle >= 135 Then
y = shp.Boundary.Top
The following code example shows access to read text in text layout objects via text string as an attribute. The script
enumerates all Attributes at the drawing object level and shows the text string as one of the options:
End Sub
Project.Schematics(1).Layout.DrawingObjects(1).Shapes(1).Attributes("TextString").Value
In the following script we use CellEditor to access layout text attribute for the library Cell:
tmpnam = "Tmp_Annotation_Txt_Read"
If Project.CellLibraries.Exists("tmpnam") Then Project.CellLibraries.Remove(tmpnam)
Set sch = Project.Schematics("Test")
Set ced = sch.Layout.CreateCell(tmpnam,tmpnam).EditCell
End Sub
Note: Sometimes it will be easier to use Snapshot instead of CellEditor to access layout text attribute for the library Cell
The flipHorz argument tells the Move command whether the flip is to occur about the horizontal axis or the vertical axis.
For a flip to occur, the argument Flip must be "True". The second argument flipHorz can be "True" or "False" depending
on whether the flip is to occur around the horizontal or vertical axis.
The Polygon Writer and the associated PolygonRecord object are intended to provide an efficient method for creating
complex polygons and importing large amounts of PCB board data into layout. The Writer allows you to setup the shape
attributes such as layer name, layer mapping using process layers up front and then create a number of objects using
those settings. The Record provides an efficient means for specifying the polygon and cutouts specified in the board
data. The Record can be reused by clearing after each polygon to create multiple polygons.
In the following script the polygon Writer will write a simply polygon, so the Record does not include attributes requiring
a complex polygon. The complex polygon object has additional data structures to support cutouts and arc segments, so
each complex polygon object is larger in memory size than a standard polygon. This feature is intended to save memory
in cases where the polygon doesn't require the features of a complex general polygon:
Sub Main
Dim lay As Layout
Dim objDraw As DrawingObject
Dim polyWrite As PolygonWriter
Dim polyRec As PolygonRecord
Debug.Clear
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
Set polyWrite = lay.DrawingObjects.PolygonWriter
polyWrite.LayerName = "Thick Metal"
polyWrite.AddPolygon(polyRec)
End Sub
To add a cutout to the plain polygon use InvokeCommand() method as in the following code:
The following script provides an example of using the polygon writer to add a complex polygon with cutouts:
Sub Main
Dim lay As Layout
Dim polyWrite As PolygonWriter
Dim polyRec As PolygonRecord
polyRec.AddPolySegment(30e-6, 30e-6)
polyRec.AddPolySegment(10e-6, 30e-6)
polyRec.PolyCutoutEnd
Debug.Print "***"
Debug.Print "* Polygon Writer Net Name = " & lay.DrawingObjects.ActiveNetName
Debug.Print "***"
End Sub
Note, The polygon writer object has a net name property as we mentioned before, which should be passed along as the
net name for any objects created by the polygon writer. When the polygon writer is created the net name is inherited
from the active net name associated with the DrawingObjects collection. If the net name is changed on the writer then
that net name overrides the inherited name for subsequently created objects. In the code above we verify that the polygon
writer passes the net name set on the writer to created objects. We also need to know that the net name is inherited when
the polygon writer is created and if the net name is changed on the polygon writer then the set name on the writer will
override the inherited net name for subsequent objects.
API provides methods in the schematic implementation to highlight all objects in layout that have a given net name. The
highlight can be turned on or off for the group and there is an additional method to Unhighlight all objects. The highlight
is enabled by setting the display mode of the objects to include highlight and invalidating the region where objects exist
that have had their highlight display mode enabled/disabled. Currently highlight consists of drawing red dotted line
around the perimeter of the shapes.
We also need to mention that we added information on cutouts to the info status text produced by the generalized polygon
when the output is in multiline mode. Thies status text supplied for the Info tab on the shape propertied dialog information
about the cutouts in the generalized polygon. For each we provide a description of the type of cutout (Rectangle, Polygon,
Rectangle, Ellipse) and a list of the points. For performance reasons the output is limited to the first 20 cutouts and each
cutout is limited to the first 50 points.
API provides access, to modify, and add sub-objects to a complex polygon object. The API supports a couple of interfaces
for accessing a collection of sub-objects that belong to a drawing object. Those interfaces connect up the
DrawingSubObjects collection as a property of the DrawingObject. Objects can be added or removed and existing objects
can be modified through vertex, edit handle, and attribute collections. Objects that can be added include polygon, rectangle,
circle and ellipse.
the user to quickly verify the ActiveNetName for a shape by selecting it and looking at the status information at the
bottom of the AWR DE.
PrintVertices(subObj.Vertices)
Debug.Print "PolyVertices: "
PrintVertices(subObj.PolyVertices)
PrintBoundary(subObj.Boundary)
PrintAttributes(subObj.Attributes)
PrintEditHandles(subObj.EditHandles)
Next subObj
End Sub
Sub PrintAttributes(ByRef attrs As Attributes)
Dim attr As Attribute
Debug.Print "Attributes:"
For Each attr In attrs
Debug.Print attr.Name & " = " & attr.ValueAsString
Next attr
End Sub
For accessing and manipulating the edit handles collection associated with sub-objects in a complex polygon object API
provides the individual stretch handles of a drawing sub-object, so the sub-object can be enumerated and moved.
The following code shows API methods for adding cutouts to plain polygon object. Before we showed the code that uses
InvokeCommand() method to add cutouts to the plain polygon. The following code starts with a plain regular polygon
(not on process layers) and then attempts to add a cutout to the object using the SubObjects collection. This requires that
the plain polygon object to be replaced by a complex polygon which can support the new cutout methods and then the
cutout will be added to the new object. This script shows not only the addition of the cutout but also re-connecting the
automation wrapper objects when the target object is replaced. The sub-object state before and after adding the cutout
is dumped out as shown before:
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
End Sub
x = 10e-6
y = 10e-6
xyPoints(0) = x
xyPoints(1) = y
y = y + 20e-6
xyPoints(2) = x
xyPoints(3) = y
x = x + 20e-6
xyPoints(4) = x
xyPoints(5) = y
y = y + 20e-6
xyPoints(6) = x
xyPoints(7) = y
x = x + 20e-6
xyPoints(8) = x
xyPoints(9) = y
y = y - 20e-6
xyPoints(10) = x
xyPoints(11) = y
x = x + 20e-6
xyPoints(12) = x
xyPoints(13) = y
y = y - 20e-6
xyPoints(14) = x
xyPoints(15) = y
objDraw.SubObjects.AddPolygon(xyPoints)
To flatten, rotate, flip, mirror and Copy/Paste complex polygon you can use InvokeCommand() methods for shape:
To mirror:
To access the segments and arc segments associated with sub objects of a complex polygon object API provides a
segments collection for drawing sub objects which mimics the segments collection associated with normal drawing
objects and in particular gives access to the details of an arc segment. The followin routone shows how to use the segments
collection:
Sub Main
Dim lay As Layout
Dim objDraw As DrawingObject
End Sub
Sub PrintSegmentState(ByRef segs As DrawingSegments)
End Sub
There have been a number of improvements made to the AWR DE API to support access to the details of generalized
polygons. The API changes support efficient import of PCB board data to create generalized polygons and editing the
details of generalized polygons in the design environment. Normally in the API when we want to access the details of a
polygon object in layout, we start with the Project object, from that we get the specific Schematic of interest and then
access the layout associated with that schematic. The layout contains a collection of drawing objects which represent the
individual objects in the layout. Graphically this looks like the following:
In Figure 1 the DrawingObject at the bottom represents the polygon object in the DrawingObjects collection of the
Layout. The DrawingObject provides a number of properties and attributes that provide detailed information about the
layout object. For example, you can find the base position which represents the object location as well as the orientation
of the object indicating the rotation angle and the horizontal and vertical flip state.
Sub Main 'Accessing the drawing objects of a schematic layout and printing the base position
Dim lay As Layout
Dim objDraw As DrawingObject
' Go through the DrawingObjects collection and print base position of each
For Each objDraw In lay.DrawingObjects
Debug.Print "Base Position = " & objDraw.BasePosition.x * 1e6 & ", " & objDraw.BasePosition.y
Next objDraw
End Sub
Listing 1. Accessing the drawing objects of a schematic layout and printing the base position.
We start by dimensioning a Layout object and a DrawingObject. Then we set the Layout object to reference the Layout
associated with the Schematic named "Schematic 1" in the Project. The following For Each loop then goes through each
of the DrawingObjects in the Layout's DrawingObjects collection and for each one accesses the BasePositon property
to print the X and Y coordinates of the BasePosition.
The DrawingObject contains two collections which provide access to the details of a generalized polygon:
1. The SubObjects collection provides access to the cutout objects on a generalized polygon.
2. The Segments collection provides access to the segments, including arc segments associated with a generalized
polygon.
Figure 2. SubObjects and Segments collection properties for accessing details of a generalized polygon.
For example, we have a generalized polygon with a single cutout, as shown in Figure 3, and we want to access the vertices
of that cutout in the polygon:
Then we can display the vertices for this cutout using the SubObjects collection to traverse the sub-objects and printing
the vertices of each sub-object. In this case there will be only one sub-object since we only have one cutout.
Note: Here we have written the code as a subroutine which takes a DrawingObject and then traverses the SubObjects
property of that drawing object. For each SubObject it then traverses the Vertices collection to print each Vertex X and
Y value of the Vertex. Running this code we get the following output for the polygon of Figure 3:
This shows the base position of the polygon object (output from Listing 1) along with the Vertex output obtained by
calling the DisplayCutoutVertices() subroutine from the loop right after the base position is printed and passing a reference
to the drawing object.
The SubObject collections also contain methods for adding, removing, and moving sub objects within the generalized
polygon. If we wanted to add a circle cutout above the rectangle and a square and an ellipse to the right we can do that
as follows:
Listing 3. Adding additional square, ellipse, and circle cutouts to the general polygon of Figure 3.
Note: this short subroutine adds the cutouts using the SubObjects collection associated with the generalized polygon
DrawingObject. The result of running this subroutine on the polygon of Figure 3 is as follows:
Figure 4. Result of running the subroutine to add cutouts to the polygon of Figure 3.
Figure 4 shows that a rectangle and ellipse have been added to the right and a circular cutout has been added above the
original rectangle cutout.
The cutouts can also be moved using the SubObjects collection. For example, if we wanted to move each of the cutouts
40um upward we could do that using the following subroutine:
' Traversing the SubObjects collection on an DrawingObject and moving each object.
For Each subObj In objDraw.SubObjects
subObj.Move(0, 40e-6)
Next subObj
End Sub
Listing 4. Traversing the SubObjects collection on an DrawingObject and moving each object.
In this routine we traverse each of the SubObjects associated with the given DrawingObject and call the Move() method
on each supplying a dx=0 and a dy=40um. This will move each of the cutouts 40um upward in the y direction. The results
of running this subroutine on the polygon of Figure 4 looks as follows:
Figure 5. Results of shifting each of the cutout shapes 40um upwards in the y direction.
Figure 5 shows the results of the move operation, each of the cutout shapes from Figure 4 have shifted 40um upward.
Cutouts can also be removed from polygon using the SubObjects collection. For example, we wanted to remove the
circle and the ellipse. We can remove all the circles and ellipses using the following subroutine:
' Traversing the SubObjects in reverse order and removing circles and ellipses.
For i = objDraw.SubObjects.Count To 1 Step -1
Set subObj = objDraw.SubObjects(i)
If (subObj.Type = mwDSO_CutoutCircle Or subObj.Type= mwDSO_CutoutEllipse) Then
objDraw.SubObjects.Remove(i)
End If
Next i
End Sub
Listing 5. Traversing the SubObjects in reverse order and removing circles and ellipses.
Removing items is a little tricky because you'll be trying to remove objects from a collection while also traversing the
collection. One technique that is often successful is to traverse the collection from the end to the start and remove them
as we go. This way the objects we are removing will be behind the objects we still have to traverse in the collection so
they won't change the count of the remaining objects. In this subroutine we have used a For loop with an index variable
which counts from the number of items in the SubObjects collection down to the first index which will be 1. Each time
through we check the type and if it is a circle or ellipse then remove the object. Again since the objects we'll be removing
are behind the objects we still have to traverse they don't affect the count or the index we need for the remove operation.
This way we don't need to do anything fancy with the index when we remove an object. When we run this subroutine
on the polygon from Figure 5 we get the following:
Figure 6. Results of removing the circle and ellipse cutouts using the SubObjects collection Remove method.
Figure 6 shows that the Ellipse on the right end and the circle above the first square have been removed. So the SubObjects
collection provides a flexible way of editing and updating the cutout shapes associated with a generalized polygon.
PCB data is often structured in terms of segments and arc segments in a polygon object. To make accessing and working
with polygon segments easier the DrawingObject has a sub-collection of segments. This can be used to traverse the
segments of the polygon and to convert a segment into an arc segment or revert an arc segment back into a normal
segment. For example, we have a layout with a simple rectangle object.
Given the DrawingObject accessed as we show before we can traverse the segments of this polygon as follows:
When we run this and pass it the DrawingObject representing the square above we get the following output:
From these values we can see that the square has it's lower left corner at 0,0 and has a width and height of 100um. In the
output we added an index so we can tell which segment pertains to each side of the polygon. Let's suppose we want to
make the right side of the square into an arc segment. Looking at the segments we can see that segment #3 goes from
(100, 0) to (100,100).
So to convert this to a segment we need to pick a center for the arc and a direction. Let's say we want to make a half
circle, so we'll put our center in the middle of the side where we are adding the arc segment or the point (100, 50). This
will be halfway up the right side.
For the direction we can choose counter-clockwise or clockwise. Here it helps to have a little background on the winding
directions for polygons. In the AWR DE normal polygons can be wound in either direction clockwise or counter-clockwise.
But a generalized polygon will always have the outer polygon wound counter-clockwise. So given this a counter-clockwise
arc segment will curve outward and a clockwise arc segment will curve inward.
Figure 8. Viewed as a radial segment from the center to the edge we can see that counter-clockwise will sweep outward
and clockwise will sweep inward.
So if we select counter-clockwise that should add an extra half circle to the right side of the rectangle object. If we choose
clockwise it will cut a semi-circle out of the right side of the rectangle. For the first case let's add the extra half semi-circle
to the rectangle by selecting counter-clockwise.
If (objDraw.Segments(3).CanMakeArcSegment) Then
objDraw.Segments(3).MakeArcSegment(100e-6, 50e-6, mwDAD_CounterClockwise)
End If
End Sub
This code first verifies that the side can be converted to an arc segment, this verifies that the drawing object can be
converted to a generalized polygon and that in the resulting polygon the side can be made into an arc. Then we request
the segment be made into an arc segment with a center point halfway up the right side and in the counter-clockwise
direction. We get the following result:
Figure 9. The result of running the CreateArcSegment() subroutine on the rectangle drawing object using counter-clockwise
direction.
If we do this again but instead request a clockwise direction using the following code:
If (objDraw.Segments(3).CanMakeArcSegment) Then
objDraw.Segments(3).MakeArcSegment(100e-6, 50e-6, mwDAD_Clockwise)
End If
End Sub
Figure 10. The result of running the CreateArcSegment() subroutine on the rectangle drawing object using clockwise
direction.
Using the MakeArcSegment() method on the Segment object we can convert a normal segment into an arc segment that
curves either outward, or inward.
Each of the segment objects in the segments collection contains a Boolean property for checking if that segment is an
arc-segment. The segments also contain a method for reverting an arc-segment back to a normal segment. Using the
IsArcSegment property and the RevertArcSegment() method we can write a routine to remove all the arc-segments from
a DrawingObject:
Listing 9. Traversing the segments of a drawing object and reverting any arc segments.
In the RemoveArcSegments() subroutine we walk through each of the segments associated with the DrawingObject and
ask if each is an arc-segment. If it is, then we ask the segment to revert the arc segment into a normal segment. Running
this subroutine on the rectangle object gives the same result as in Figure 7.
Calling RevertArcSegment on each of the segment objects restores the object to a simple rectangle with straight sides.
Segments are also available from each of the SubObjects within a generalized polygon object. This means that we can
use the same techniques to traverse the segments and convert segments to arc-segments on sub-objects that we used on
the generalized polygon itself. For example, suppose we took the rectangle polygon of Figure 7 and added a single
rectangle cutout in the bottom-left corner as shown in Figure 11.
We can traverse the segments of a sub-object similar to how we traversed the vertices but access the Segments collection
on each SubObject rather than the Vertices as follows:
Next seg
Next subObj
End Sub
Again, here we added an index beside each segment in the output so we can see which one we might want to convert
into an arc-segment. In this case Segment #3 goes from (40,10) to (40,40) which represents the right side of the rectangle.
Let's see if we can convert that segment into an arc-segment:
If (subObj.Segments(3).CanMakeArcSegment()) Then
subObj.Segments(3).MakeArcSegment(40e-6, 25e-6, mwDAD_Clockwise)
End If
End Sub
Listing 11. Adding an arc segment on the right side of the rectangle cutout.
The code for this is similar to that from Listing 8 with one slight difference. Because cutouts are wound in the opposite
direction of the outer polygon the direction is also different. So for a cutout to get an outward arc we want to use a
clockwise direction. Likewise if we want an inward arc we want to use counter-clockwise. If we pass the drawing
sub-object associated with the rectangle to the subroutine of Listing 11 we get the following result:
Figure 12. Result of converting the rectangle cutout right-side segment to an arc segment.
Similar to the outer polygon the result of converting a sub-object segment to an arc segment allows us to curve the
segment inward or outward depending on the direction we choose. The segments collection for a sub-object also contains
the methods for checking if a segment is an arc segment and reverting an arc segment so we can also remove the
arc-segment attributes from a segment.
Using the DrawingObject's SubObjects collection and the Segments collections associated with the DrawingObject and
the DrawingSubObjects we have complete programmatic access to generalized polygons. The details of the polygon
features can be accessed, added, modified, and removed including sub-objects and arc segments.
The AWR DE includes API support custom tailored for efficiently importing (Printed Circuit Board) PCB board data
into layouts. In particular, the API is tailored to make importing data specified in the standard IPC 2581 printed board
and printed board assembly format convenient to import. The API for importing board data provides an object for writing
polygons and one for writing paths. Graphically looking at the object model we have the following structure for these
objects:
Figure 13. PolygonWriter and PathWriter objects obtained form the DrawingObjects collection.
At the bottom of Figure 13 we see that we can obtain a PolygonWriter and PathWriter from the drawing objects collection.
When we use these objects we will be writing polygons and paths into the DrawingObjects collection for the layout.
There are actually two separate objects involved in using each of the writer objects. There is the Writer object itself
which includes properties such as the DrawingLayer that will be true for a number of paths or polygons. And there is a
record object which holds the details for one object such as the path or polygon vertices.
Figure 14. Path and Polygon Writer objects and their associated Record objects.
So if we are planning on creating polygons we will be using PolygonWriter and the PolygonRecord objects. For example,
to write polygons, the first step would be to obtain a PolygonRecord from the PolygonWriter to contain the details for
each polygon that will be output. Next, we'd set the output layer for the initial set of polygons to be written. Next, we'd
fill out the PolygonRecord with the details of the polygon including segments and cutouts. Then we'd ask the PolygonWriter
to create the polygon passing it the details in the PolygonRecord object. We can then clear the PolygonRecord, fill it out
with the details of the next polygon, and then ask the PolygonWriter to create the next polygon, passing it the
PolygonRecord object with the details. Once we've finished all the polygons on that layer we can set a new layer on the
PolygonWriter object and then use the PolygonRecord to start writing polygons on the next layer, clearing the record
between each one and filling it out with the details of the next polygon and passing that to the PolygonWriter.
To begin with let's see how the flow outlined in Figure 15 works by creating a couple of simple polygons on the "Thick
Metal" layer:
' Get a polygon writer from the DrawingObjects collection of the layout.
Set pw = lay.DrawingObjects.PolygonWriter
CreateSimplePolygons(pw)
End Sub
' Create the polygon using the polygon writer by supplying the record.
pw.AddPolygon(pr)
' Create the polygon using the polgon writer by supplying the record.
pw.AddPolygon(pr)
End Sub
Listing 12. Code to implement each of the steps illustrated in Figure 13 to create a couple of polygons on "Thick Metal"
layer.
The code in Listing 12 is a little longer than most examples but shows each of the steps illustrated in Figure 15 on the
flow for creating polygons using the PolgonWriter and the PolygonRecord objects. Let's start by looking at the Main
Subroutine:
' Get a polygon writer from the DrawingObjects collection of the layout.
Set pw = lay.DrawingObjects.PolygonWriter
CreateSimplePolygons(pw)
End Sub
Listing 13. Setup for the writing process by obtaining a Layout reference and PolygonWriter reference.
We start in the Main subroutine by getting a reference to the layout we are going to write the polygons to, and then
obtaining an PolygonWriter reference from the DrawingObjects collection associated with that layout. This will allow
us to write polygon objects directly into the DrawingObjects collection for the Layout. This corresponds to the top portion
of the flow in Figure 15. Once we have a reference to the polygon writer we call a subroutine to write the actually
polygons:
' Create the polygon using the polygon writer by supplying the record.
pw.AddPolygon(pr)
' Create the polygon using the polgon writer by supplying the record.
pw.AddPolygon(pr)
End Sub
Listing 14. Writing the actual polygons using the PolygonWriter with a PolygonRecord.
Once inside the CreateSimplePolygons subroutine we first create a PolygonRecord object to describe the polygon details
and then set the initial output layer on the PolygonWriter. Next, the details for the first polygon are provided to the
PolygonRecord using the PolygonBegin(), AddPolySegment(), and PolygonEnd() methods to describe the segments in
the polygon outline. The PolygonBegin method describes the starting point for the polygon object. Each AddPolySegment()
call then described an end-point for a segment that forms the side of the polygon. It is not necessary to close the polygon
by providing a segment back to the start point, the shape will be closed automatically from the last end point.
Once we have finished adding the polygon details to the polygon record we can add the polygon to the DrawingObjects
collection using the PolygonWriter's AddPolygon() method and supplying the PolygonRecord which contains the details.
We can then begin to describe the next polygon to be added on the same layer. For efficiency we can reused the
PolygonRecord object by clearing the details of the last polygon before we add details of the new polygon. After the
PolygonRecord has been cleared we can begin describing the next polygon to the record object, again using the
PolygonBegin(), AddPolySegment(), and PolygonEnd() methods. Once we have described the polygon details in the
PolygonRecord object, we can add the second polygon using the PolygonWriter's AddPolygon() method and supplying
the updated PolygonRecord which has the details. Note that until we change the layer on the PolygonWriter object all
subsequent polygons will be created on the current layer we have set. We can think of the LayerName property on the
PolygonWriter as the active layer for input.
When adding the polygon we followed a process of providing a start point and then adding segment end points to the
polygon and eventually calling a method to mark the end of the polygon. If we take a look at a sample of IPC 2581 PCB
board data we can see how this aligns with the structure of the data:
<Contour>
<Polygon>
</Polygon>
<Cutout>
</Cutout>
</Contour>
In this data the Contour describes an overall generalized polygon. This sample shows an outer polygon along with a
single cutout in the polygon. Looking at the <Polygon/> section it describes the polygon as a PolyBegin start point
followed by a series of PolyStepSegment points. This aligns with the methods on the PolygonRecord object for specifying
a polygon. The <PolyBegin x="", y="" > corresponds to the PolygonRecord's BeginPolygon(x, y), each of the
<PolyStepSegment x="", y=""> corresponds to a call to the PolygonRecord's AddPolySegment(x, y), and finally the
</Polygon> corresponds to the EndPolygon() call.
The results of running the script from Listing 12 are shown in Figure 16:
Figure 16. The results produced by using the PolygonWriter to create two simple rectangle polygons in layout.
Figure 16 shows the results we obtain in layout from the using the PolygonWriter to create two simple rectangular
polygons. We can also add arc segments when specifying segements to the PolygonWriter object. If we look at a sample
of IPC 2581 XML which includes arc-segments we can see that they are specified like normal segments except with
additional information to specify the center and direction for the arc-segment:
<Contour>
<Polygon>
</Polygon>
</Contour>
Listing 16. Sample IPC 2581 XML Polygon specification with arc-segments.
In the example from Listing 12 we can add arc segments by modifying the calls made on the PolygonRecord to replacing
a couple of the AddPolySegment() calls with AddPolyArcSegment() calls as follows:
' Create the polygon using the polygon writer by supplying the record.
pw.AddPolygon(pr)
' Create the polygon using the polgon writer by supplying the record.
pw.AddPolygon(pr)
End Sub
Listing 17. CreateSimplePolygons subroutine modified to create arc-segments on the right side of the polygons.
Like the IPC 2581 XML the changes necessary to create arc segments merely requires changing how we add the segments
to specify additional information about the arc center and the arc direction. We use the PolygonRecord's
AddPolyArcSegment() method to specify the segment and the addition information needed for the arc. The results of
running this subroutine are as follows:
Figure 17. Adding two polygons with arc-segments specified for the right sides.
Figure 17 shows the results when we run the subroutine of Listing 17 which specifies that the right-sides of the polygons
should be arc-segments with the center point half way up the right side of the rectangle.
The IPC 2581 XML sample in Listing 15 also shows how cutouts within a contour are specified very similar to the way
segments for the polygon are specified. The PolygonRecord object also provides methods for specifying the start and
segments of a polygon cutout. Let's try creating an example that parallels Listing 15 and includes a single polygon with
a single cutout. The code for this is as follows:
pr.AddPolySegment(40e-6, 40e-6)
pr.AddPolySegment(40e-6, 10e-6)
pr.PolyCutoutEnd
' Create the polygon using the polgon writer by supplying the record.
pw.AddPolygon(pr)
End Sub
Similar to the structure of the IPC 2581 XML in Listing 12 we first use the PolygonRecord to specify the details of the
Polygon object and then we do a similar specification for the cutout. The difference is that we start with PolyCutoutBegin()
and end with PolyCutoutEnd() methods to indicate that this polygon will be a cutout. Once both the polygon and the
cutout have been specified in the PolygonRecord object we provide this to the PolygonWriter and ask it to create a
polygon object with AddPolygon().
Figure 18. Adding a single rectangle polygon with a single rectangle cutout.
Likewise we can add arc-segments into the cutouts just as we did for the outer polygon by changing the segment
specifications from AddPolySegment() calls to AddPolyArcSegment() calls. For example, we can add an arc-segment
to the right side of the cutout as follows:
' Create the polygon using the polgon writer by supplying the record.
pw.AddPolygon(pr)
End Sub
Similar to what we did in Listing 17, here we have changed one of the AddPolySegment() calls to be a
AddPolyArcSegment() when creating the arc-segment in the cutout. Running this we get the following output:
Figure 19. Adding a single polygon with a single cutout that includes an arc segment on the right side.
The polygon record also includes support for directly specifying circular and elliptical cutouts. These can be added to
the polygon specification using the AddCircleCutout() and AddEllipseCutout() methods. For example, the following
script adds a circle and an elllipse cutout to the simple polygon object:
' Create the polygon using the polgon writer by supplying the record.
pw.AddPolygon(pr)
End Sub
Circle and Ellipse cutouts can be added to the PolygonRecord object with a single call each. In Listing 20 we first create
the polygon and then make calls to add a circle and ellipse cutouts. The Circle we specify the center point and a radius
and for the ellipse the upper-left corner and the width and height of a rectangle the ellipse should be inscribed into. The
results of running this subroutine are shown in Figure 20:
Figure 20. Adding a rectangle polygon with a circle and an ellipse cutout.
Using the PolygonWriter and the PolygonRecord we can efficiently specify generalized polygons to be written into the
drawing objects collection of a layout in a manner that aligns with the structure of PCB layout data. In particular the API
is convenient for adding data specified in the IPC 2581 XML format.
The PathWriter and PathRecord objects operate in a similar fashion to the PolygonWriter and PolygonRecord objects.
However, in addition to specifying just the output layer, the PathWriter allows the specification of a number of additional
common attributes of the path objects to be output. For example the path end type, the path width, and the type of bend
to use at the corners can be specified along with the output layer. Once these values are specified they will be inherited
by all paths created by the PathWriter until they are changed.
For example, let's use the PathWriter and PathRecord objects to create a path with rounded ends and rounded corners in
layout. The process will be very similar to what we did with the PolygonWriter. The code to do this is as follows:
' Get a polygon writer from the DrawingObjects collection of the layout.
Set pw = lay.DrawingObjects.PathWriter
CreatePath(pw)
End Sub
' Add the path using the path writer supplying the path record.
pw.AddPath(pr)
End Sub
Listing 21. Creating a PathWriter object and using it with a PathRecord object to create a path object in layout.
The process and code contained in Listing 21 is very similar to that of Listing 12 where we added two polygon objects
using the PolygonWriter. In the main() subroutine at the top we get a reference to the layout we want to add the paths
into. Then from the DrawingObjects collection on the layout we get a reference to a PathWriter object. The code then
calls the CreatePath() subroutine and passed the PathWriter reference. Once inside the CreatePath() subroutine we have
the PathWriter create and return a reference to a PathRecord object to use for specifying the details of the paths. Then
we specify the common attributes for the paths that will be added on the PathWriter. These attributes will be set on each
path that is added using the PathWriter until they are changed. In this case we are specifying the "Thick Metal" drawing
layer, Rounded outside corners for curves with the Rounded Miter style, rounded path ends and a path width of 20um.
Once the common attributes have been specified on the PathWriter we can begin to specify the path details using the
PathRecord object. Here we specify the vertices for a 3 segment path. Once the path details are specified using the
PathRecord, this is passed to the PathWriter to create the path in layout. The results of running this program are shown
below:
Figure 21. Resulting path created with PathWriter and PathRecord objects.
Like with the PolygonRecord, we can now clear the PathRecord and begin specifying the next path. Once we complete
that it can be added using the PathWriter and will inherit all the common attributes such as layer, width, end and bend
styles set on the PathWriter object.
At any point we can change the common attributes on the PathWriter and then the subsequent paths we create will inherit
the updated values. For example, we could change the bend style to curved, set the miter amount which in this case
specifies the radius to 30um and specify that the paths should be output on the "Cap Bottom" layer. The remaining details
such as the rounded end style will be retained from the previous settings. The code with these changes looks as follows:
' Add the path using the path writer supplying the path record.
pw.AddPath(pr)
' Add the path using the path writer supplying the record.
pw.AddPath(pr)
End Sub
Listing 22. Adding a second path with different output layer and bend style.
In Listing 22, we've added code at the bottom of the CreatePath() subroutine to clear the PathRecord so we can use it
again. Then we've changed some of the common attributes of the paths to be written by the PathWriter. Finally we specify
a second path using the PathRecord and ask the PathWriter to create the path. The second path will receive the updated
attributes. The result is as follows:
Figure 22. Two paths created using the PathWriter and PathRecord with different attributes.
Figure 22 shows the two resulting paths, the first, on the left, is created as before. The second one on the right has inherited
the updated attributes. It has curved bends and is on the output layer "Cap Bottom".
In Layout the DrawingObjects collection has the notion of an active NetName which is the name that will be associated
with all objects created through the DrawingObjects collection. When the PolygonWriter and PathWriter objects are
created they will inherit this name by default. The PolygonWriter and PathWriter objects have a NetName property which
allows the name inherited from the DrawingObjects to be overridden for the objects created by the PolygonWriter and
PathWriter objects. However, for these objects the NetName is passed down to the PathRecord and PolygonRecord
objects. These names can again be overridden by the PathRecord and PolygonRecord objects. For any path or polygon
created by the PathWriter or PolygonWriter the resulting net name will always be that on the PathRecord or PolygonRecord
objects. So changing the value at the PolygonWriter or PathWriter level will result in future PolygonRecord and
PathRecords inheriting the new Writer value but it does not change the net name for any existing PathRecord or PolyRecord
objects that have been created. The result is that to change NetName polygons or paths to a value that is not the default
then you will want to do this at the record level. When a path or polygon is created it always gets the value that is active
at the Record level.
Conclusion.
The Board Layout Improvements provide a set of features which make importing and working with board layout and
more efficient. The support for generalized polygons directly in the layout environment makes it easy to create the types
of complex structures needed for board layout. Generalized polygons allow the layout to support polygons with cutouts
and no cutlines to the cutouts as well as arc-segments within polygons. The layout editor provides commands and methods
for editing and working with the structures contained in generalized polygons. Path objects now support rounded and
chamfered ends as well as rounded and curved bends making it straightforward to create board traces to connect
components. The API has been enhanced to provide access to, and modification of, the structures of a complex polygon
including different types of cutouts and arc-segments both on the polygon as well as in the cutouts. The API has also be
updated to provide two writer objects for creating paths and polygons with API methods that are tailored to importing
PCB layout data. The new import API objects are specifically targeted for importing data from the IPC 2581 XML format
efficiently. Overall the board layout improves make working with PCB layout data fast and efficient in the AWR DE.
Adding the layout parameters to a layout cell which is not associated with an element.
The following sections include information about API capability to add layout parameters to a cell via the layout parameters
collection. API allows to add parameters of type double, string and integer. API also has implemented read-only method
to the layout parameters collection to allow API users to determine which objects can have parameters added and which
cannot.
Sub Main
Dim lay As Layout
Dim objDraw As DrawingObject
End Sub
Debug.Print title
For Each layParam In objDraw.Parameters
Debug.Print "Param Name = " & layParam.Name
Debug.Print "Param Type = " & layParam.ParameterType
Debug.Print "Param Unit Type = " & layParam.UnitType
If layParam.ParameterType = mwLPDT_Integer Or layParam.ParameterType = mwLPDT_Real Then
Debug.Print "Param Double Val = " & layParam.ValueAsDouble
Debug.Print "Param Int Val = " & layParam.ValueAsInteger
End If
Debug.Print "Param String Val = " & layParam.ValueAsString
If objDraw.Parameters.Exists(layParam.Name) Then
Debug.Print "Param " & layParam.Name & " exists by name succeeded."
Else
Debug.Print "Param " & layParam.Name & " exists by name failed."
End If
Debug.Print "----"
Next layParam
End Sub
objDraw.Parameters.AddInteger("MyParam", 100)
objDraw.Parameters.AddString("MyParam", "MyString")
To remove layout parameter that had been added using the add methods use the following method:
objDraw.Parameters.Remove("MyParam")
The following code shows how to access layout Subcircuit special attributes:
LineType = 0
UsesProcessLayers = True
LayerMapping = 0
Anchor = False
Frozen = False
CellName =
ElementName = SUBCKT.S1
MasterDocumentName = Sub1
Sub Main
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditRotate", Array(0.0, 0.0, 90), ret )
End Sub
Debug.Print title
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
Traversing layout hierarchy using the MasterDocumentName attribute of Subcircuit objects in layout.
The following code shows how to access layout hierarchy using the MasterDocumentName attribute of Subcircuit objects:
PrintSubCellDocuments(Project.Schematics("SCH1").Layout)
End Sub
The following code shows how to access layout Rectangle special attributes:
LineType = 0
UsesProcessLayers = True
LayerMapping = 0
LayerIndex = 0
PositionFixed = False
FlipState = False
RotationAngle = 0
Area = 0.00000001
IsEMExtract = False
GroupName = EM_Extract
When accessing the layout Route special attributes the code should be:
PositionFixed = False
FlipState = False
RotationAngle = 0
NetId = 0
Associated = False
PositionFixed = False
FlipState = False
RotationAngle = 0
NetId = 15
Associated = True
To access the layout Arc attributes the objDraw.TypeBits = 1 and output will be similar to the following:
LineType = -2
UsesProcessLayers = False
LayerMapping = -2
LayerIndex = 2
PositionFixed = False
FlipState = False
RotationAngle = 0
Length = 0.000221863
CenterX = 0.00005
CenterY = 0.00025
Radius = 0.000070711
StartAngle = -135
StopAngle = 45
To access the layout Dimention Line attributes the objDraw.TypeBits = 0 and output will be similar to the following:
FontName = Arial
BoldStyle = True
ItalicStyle = True
FontHeight = 0.000025
PositionFixed = False
FlipState = False
RotationAngle = 0
ArrowLocation = 0
TextLocation = 0
ArrowLength = 0.00002
GapLength = 0.000005
Precision = 1
ShowUnits = True
ShowTolerance = True
LengthTolerance = 0
Length = 0.00092
To access the layout Equation attributes the objDraw.TypeBits = 2 and output will be similar to the following:
FontName = Arial
BoldStyle = False
ItalicStyle = False
FontHeight = 0.00001
To change the layout Artwork Cell attributes Flipstate use the following code:
Sub Main
Dim lay As Layout
End Sub
Debug.Print title
For Each objDraw In lay.DrawingObjects
Debug.Print "Boundary = ";
Debug.Print "Left = " & objDraw.Boundary.Left * 1e6;
Debug.Print ", Top = " & objDraw.Boundary.Top * 1e6;
Debug.Print ", Right = " & objDraw.Boundary.Right * 1e6;
Debug.Print ", Bottom = " & objDraw.Boundary.Bottom * 1e6;
If (objDraw.Attributes.Exists("FlipState")) Then
Debug.Print ", FlipState = " & objDraw.Attributes("FlipState").Value
Else
Debug.Print ", No FlipState Attribute"
End If
Next objDraw
End Sub
To change the layout Artwork Cell attributes Magnification use the code below. Magnification attribute for drawing
objects supports scaling through magnification changes. The Attribute can be used to resize Artwork Cell as follows:
Sum Main
Dim lay As Layout
Debug.Print title
For Each objDraw In lay.DrawingObjects
Debug.Print "Boundary = ";
Debug.Print "Left = " & objDraw.Boundary.Left * 1e6;
Debug.Print ", Top = " & objDraw.Boundary.Top * 1e6;
Debug.Print ", Right = " & objDraw.Boundary.Right * 1e6;
Debug.Print ", Bottom = " & objDraw.Boundary.Bottom * 1e6;
If (objDraw.Attributes.Exists("Magnification")) Then
Debug.Print ", Magification = " & objDraw.Attributes("Magnification").Value
Else
Debug.Print ", No Magnification Attribute"
End If
Next objDraw
End Sub
Note in the script to be able to see the results of the attribute changes in existing open views there is a call to refresh the
layout after the changes have been made. To see if a drawing object has a particular attribute you can use
objDraw.Attributes.Exists("Magnification") with an if statement.
The following sections include information about adding equations, removing equations by expression and variable
name, and adding and removing expressions to/from an existing equation.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
The following code accesses an equation in Layout. The code includes the PrintEqn equation previously described.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
PrintEqn eqn
Next eqn
Close #1
End Sub
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
Set eqn2 = lay.Equations(eqn.Expression)
If eqn2 Is Nothing Then
Print #1, "Could Not Find " & eqn.Expression & " by Expression"
Else
Print #1, "Found " & eqn.Expression & " by Expression"
End If
Next eqn
Close #1
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
varName = Left(eqn.Expression, InStr(1, eqn.Expression, "=") - 1)
Set eqn2 = lay.Equations(varName)
If eqn2 Is Nothing Then
Print #1, "Could Not Find " & eqn.Expression & " by Name: " & varName
Else
Print #1, "Found " & eqn.Expression & " by Name: " & varName
End If
Next eqn
Close #1
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
' Disable each and print the state of all after each change
For Each eqn In lay.Equations
eqn.Enabled = False
PrintEqnEnabledState(lay)
Next eqn
' Enable each and print the state of all after each change.
For Each eqn In lay.Equations
eqn.Enabled = True
PrintEqnEnabledState(lay)
Next eqn
Close #1
End Sub
The following code verifies that the Layout Equation exists by expression:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
If lay.Equations.Exists(eqn.Expression) Then
Print #1, "Found " & eqn.Expression & " by Expression"
Else
Print #1, "Could Not Find " & eqn.Expression & " by Expression"
End If
Next eqn
Close #1
The following code verifies that the Equation Expression exists by variable name:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
For Each expr In eqn.Expressions
varName = Left(expr.Expression, InStr(1, expr.Expression, "=") - 1)
Set expr2 = eqn.Expressions(varName)
If expr2 Is Nothing Then
Print #1, "Could not find expression " & expr.Expression & " by var Name: " & varName
Else
Print #1, "Found expression " & expr.Expression & " by var Name: " & varName
End If
Next expr
Next eqn
Close #1
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
For Each expr In eqn.Expressions
PrintExpr expr
Next expr
Next eqn
Close #1
End Sub
The following code accesses the Layout Expression by expression. This code includes the PrintExpr expression previously
described.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
For Each expr In eqn.Expressions
Set expr2 = eqn.Expressions(expr.Expression)
If expr2 Is Nothing Then
Print #1, "Could not find " & expr.Expression & " by Expression"
Else
Print #1, "Found " & expr.Expression & " by Expression"
End If
Next expr
Next eqn
Close #1
The following code accesses the Layout Equation Expression by a variable name:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
For Each expr In eqn.Expressions
varName = Left(expr.Expression, InStr(1, expr.Expression, "=") - 1)
Set expr2 = eqn.Expressions(varName)
If expr2 Is Nothing Then
Print #1, "Could not find expression " & expr.Expression & " by var Name: " & varName
Else
Print #1, "Found expression " & expr.Expression & " by var Name: " & varName
End If
Next expr
Next eqn
Close #1
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Set eqn = lay.Equations(1)
' Disable each expression and print state of all expressions after each.
For Each eqnExpr In eqn.Expressions
eqnExpr.Enabled = False
PrintEqnExprState(eqn)
Next eqnExpr
' Enable each expression and print state of all expressions after each
For Each eqnExpr In eqn.Expressions
eqnExpr.Enabled = True
PrintEqnExprState(eqn)
Next eqnExpr
Close #1
End Sub
Print #1, "Expression = " & eqnExpr.Expression & " Enabled = " & eqnExpr.Enabled
Next eqnExpr
Print #1, ""
End Sub
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
For Each expr In eqn.Expressions
If eqn.Expressions.Exists(expr.Expression) Then
Print #1, "Found " & expr.Expression & " by Expression"
Else
Print #1, "Could not find " & expr.Expression & " by Expression"
End If
Next expr
Next eqn
Close #1
The following code includes a Layout Equation Expression existence by Variable Name:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
For Each expr In eqn.Expressions
varName = Left(expr.Expression, InStr(1, expr.Expression, "=") - 1)
If eqn.Expressions.Exists(varName) Then
Print #1, "Found expression " & expr.Expression & " by varName: " & varName
Else
Print #1, "Could not find " & expr.Expression & " by varName: " & varName
End If
Next expr
Next eqn
Close #1
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
For Each eqn In lay.Equations
For i = 1 To eqn.NumSubexpressions
Print #1, eqn.Subexpression(i)
Next i
Next eqn
Close #1
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
eqn.Expressions.Remove("X=5")
The following code adds an Equation to a Layout using the Invoke Command:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Print #1, "Before Equation Count = " & lay.Equations.Count
Close #1
End Sub
The following code adds an Equation and Undo/Redo to Layout using Invoke Commands:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Print #1, "Before Insert Equation Count = " & lay.Equations.Count
Print #1, ""
' Perform an undo and check that we removed the equation object.
lay.InvokeCommand("EditUndo")
Print #1, "After Undo Equation Count = " & lay.Equations.Count
Print #1, ""
' Perform a redo and check that we added the equation object back.
lay.InvokeCommand("EditRedo")
Print #1, "After Redo Equation Count = " & lay.Equations.Count
Print #1, "Equation Details:"
For Each eqn In lay.Equations
PrintEqn eqn
Next eqn
Print #1, ""
Set eqn = Nothing
Close #1
End Sub
The following code Copy/Paste an Equation from Schematic to Layout using Invoke Commands method:
Sub Main
Dim lay As Layout
Dim schem As Schematic
schem.Equations(1).Selected = True
schem.InvokeCommand("EditCopy")
lay.InvokeCommand("EditPaste", Array(0.0, 0.0))
End Sub
Debug.Print title
Debug.Print "Equation Count = " & schem.Equations.Count
For Each eqn In schem.Equations
Debug.Print eqn.Expression
Next eqn
Debug.Print ""
End Sub
Debug.Print title
Debug.Print "Equation Count = " & lay.Equations.Count
For Each eqn In lay.Equations
Debug.Print eqn.Expression
Next eqn
Debug.Print ""
End Sub
You can also use Cut/Paste an Equation from Schematic to Layout using Invoke Commands method. InvokeCommands
methods Undo/Redo also can be useful.
A flatten method for the API drawing object allows users to flatten objects in layout similar to what is available from
the Layout's Draw -> Flatten Cell but a little more flexible since this can be used on drawing objects supporting things
like Route Objects and plated dumb shapes.
There are a couple of ways of flattening the selected objects could be handled. First, you can ask each object if it is
selected prior to calling flatten:
Next objDraw
End Sub
Second, you can traverse the selected objects in a layout and flatten them. (This is more efficient since you don't have
to go over all the objects in layout):
End Sub
To flatten artwork cell in layout with hierarchy we can use InvokeCommand with zero arguments, indicating that the
command should flatten all levels of hierarchy. It turns out that we allow this command to be invoked with no arguments
as well as a single argument which specifies the flatten level. To flatten all levels of hierarchy use the following code:
Sub Main
Dim lay As Layout
Dim ret As Variant
Dim dl As DrawingLayer
Dim objDraw As DrawingObject
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
lay.SelectedObjects.AddAll
lay.InvokeCommand("CellFlatten")
Debug.Print title
Debug.Print "DrawingObjects Count = " & lay.DrawingObjects.Count
For Each objDraw In lay.DrawingObjects
PrintDrawingObject objDraw
Debug.Print ""
Next objDraw
Debug.Print ""
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
End Sub
lay.SelectedObjects.AddAll
lay.InvokeCommand("CellFlatten", Array(1000))
Snapshot
You cannot directly add Shapes to a Layout, but you can create a "snapshot" and then add Shapes to the snapshot. You
can use the snapshot for export and other operations. The NI AWR SDE does not currently support a Shapes collection
directly off of the Layout because many of the Shapes in Layout are programmatic cells. It is impossible to get the Shapes
of a programmatic cell directly, without first flattening the cell. Once the cell is flattened, you can manipulate the vertices
of the Shapes and see the edits in the Layout. Creating a snapshot flattens these cells into their raw Shapes, after which
you can work with the Shapes. A snapshot acts as a Layout copy that is free of binds to any Schematic.
As shown in the code, you can get a collection of Vertices from the Shape. The collection of Vertices represents the
points in the object. You can use the Add method to add a new Vertex to the Vertices collection and so to the Shape
object. The Add method takes an X value and a Y value and returns a reference to the new Vertex object that is created,
so in the Add method the third parameter is the return value. This allows you to add a vertex to an object and then later
move the vertex by changing its X and Y values.
The following script is an example of accessing hierarchical Path information for Shapes produced from a Drawing
Object contained in a Layout snap shot.
The script gets information for Shapes produced from PCells contained in levels of hierarchy with a hierarchical Path
from the initial Object, down to the lowest level PCell that produced the Shapes.
Debug.Clear
Set lay = Project.Schematics("top").Layout
Set snap = lay.CreateSnapshot
This code generates the following output: Shape, Type = 1, Path = top:MLIN.TL1,0 Shape, Type = 1, Path =
top:MLIN.TL1,0 Shape, Type = 1, Path = top:MLIN.TL1,0 Shape, Type = 1, Path = Shape, Type = 1, Path = Shape,
Type = 1, Path = top:SUBCKT.S1,0/middle:SUBCKT.S1,0/bottom:MLIN.TL1,0 Shape, Type = 1, Path =
top:SUBCKT.S1,0/middle:SUBCKT.S1,0/bottom:MLIN.TL2,0
The following scripts are examples of providing some layer based shape modification and boolean operations to API
Layout snapshot object.
In the next code we apply snapshot method for union between layers and output to a single destination layer. This allows
two source layers to be merged and output on a second layer. It also supports union of shapes in a single layer if all layers
are the same.
End Sub
Debug.Print title
For Each objDraw In lay.DrawingObjects
Debug.Print "Boundary = { left = " & objDraw.Boundary.Left * 1e6 & ", Top = " & objDraw.Boundar
PrintDrawObjShapes objDraw
Next objDraw
Debug.Print ""
End Sub
The following script is an example of providing API Snapshot method for union shapes both by layer and and merge all
to a destination layer.
snap.CopyToLayout(lay2, 0, 0)
The following script is an example of providing API a snapshot from the active layout (unless it's the output layout),
then runs Boolean subtract and union to generate the final m1 layer from m1+ and m1-. We can control visibility to turn
on or off for all layers. We had an issue with the layout ellipse object not drawing into the shape buffer surface or shape
flatten surface if the layer was not visible. The ellipse does a check that setting the layer succeeds before drawing. This
is normally a signal that the layer is not visible so there is no need to draw. In some cases, though the layer visibility is
not important for the drawing operation required. For these cases we have a drawing surface mode to draw all objects.
It seems as though the flatten shape surface and shape buffer surface should have this by default, so we added a flag
which is enabled by default to put these surfaces in Draw All Objects mode.
Option Explicit
Sub Run_Snapshot_with_layers_hidden
SetLayerVis(False)
Call RunSnapshot
SetLayerVis(True)
End Sub
Sub Run_Snapshot_with_layers_visible
SetLayerVis(True)
Call RunSnapshot
End Sub
'$Menu=Hidden
Sub RunSnapshot
Dim schIn As Schematic, schOut As Schematic, lay As Layout, s As Snapshot
Dim layA As String, layAm As String, layAp As String, layTmp As String
layA = "m1"
layAm = "m1-"
layAp = "m1+"
'SetLayerVis(False)
Set s = lay.CreateSnapshot
schOut.Layout.Views(1).ViewAll
schIn.Windows(1).Activate
End Sub
Private Function SetLayerVis(isVis As Boolean)
Dim drwLays As DrawingLayers, dl As DrawingLayer
Set drwLays = Project.ProcessDefinitions(1).LayerSetup.DrawingLayers
drwLays.AllVisible=isVis
End Function
Set s = Project.Schematics.ActiveSchematic
If (s Is Nothing) Then
noSchem = True
ElseIf s.Name = "output" Then
noSchem = True
End If
If noSchem Then
MsgBox ("Open a schematic layout (besides 'output') and run the script. The result will appear in
Exit All
End If
Set GetActiveSchematic = s
End Function
When performing boolean operations in SPP Rules or DRC Rules, shapes on A and B input layers are retained (unless
A/B is the 'target' layer; the behavior then is optional in SPP rules, and we believe that DRC just overwrites.) Non-target
layers are always retained.
The new methods have optional boolean params 'keepLayer1', 'keepLayer2' (defaulting to true). These allow the user to
retain the original layer shapes after the boolean operation runs.
We added 'mwPJ_SameOrigin' as a new enum value to the enum_mwPlacementJustfication enumeration. This option
adds no additional offset to the shapes (except any x,y specified in the CopyToLayout(), CopyToCellEditor(),
CopyToSnapshot(), CopyLayerToLayout(), CopyLayerToCellEditor(), or CopyLayerToSnapshot() methods. In the above
CopyTo* methods, pulled out a free function GetOffsetForCopy() which takes x,y, justification, and boundary, and
returns (out param) the offset.
In the following code we apply snapshot method for copy all kind of text objects. We need a schematic with some shapes
on layer Default and Copper03. There are Polygons, Rectangles, poly- and non-poly text objects. The code should copy
all shapes on Copper03 and Default 50um to the right, using the Snapshot API. The newly copied shapes should have
all shapes, including the non-poly text objects:
Option Explicit
Sub Main
Dim sch As Schematic, lay As Layout, s As Snapshot
Dim layA As String, layAm As String, layAp As String, layTmp As String, layDef As String
Dim x0 As Double, y0 As Double
layA = "Copper03"
layDef = "Default"
Set s = lay.CreateSnapshot
x0 = s.Boundary.Left
y0 = s.Boundary.Bottom
In the following code we apply snapshot method for copy and resize shapes to layer:
In the following code shows snapshot methods to copy shapes on a specific layer from a snapshot object to a layout, cell
editor or snapshot:
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
PrintVertices(drawingObj.Shapes(1).Vertices)
End Sub
End Sub
API has support for resize-copy to the list of Boolean operations supported by the snapshot API object. To make the
snapshot more useful for shape processing we'd implemented a number of Boolean operations that can be performed on
the shapes in a snapshot. We added Resize-Copy method to the list which can be very useful for operations that require
shapes on a layer to be sized relative to the shapes on a different layer. For example, structures like thin film capacitors.
In the following code we show the new resize-copy method of the API snapshot object. The test resizes and copies shapes
from two different layers and moves them to the same destination layer:
Sub Main
Dim lay1 As Layout
Dim lay2 As Layout
Dim snap As Snapshot
Sub Main
Dim lay1 As Layout
Dim lay2 As Layout
Dim snap As Snapshot
Sub Main
Dim lay1 As Layout
Dim lay2 As Layout
Dim snap As Snapshot
End Sub
API snapshot boolean operation methods include intersection, exclusive or and subtraction of shapes on individual layers
and between layers. In the following code we show API snapshot XOR when moving shapes from multiple layers to a
destination layer and performing XOR operations on the resulting shapes:
snap.CopyToLayout(lay2, 0, 0)
In the following code we show API snapshot intersection shapes and moving them to a destination layer:
The following script is an example of exporting shapes from a snapshot and then re-importing the resulting library.
The script creates a snapshot from a schematic layout. Then exports this snapshot as a GDSII file, re-imports the resulting
GDSII file and dumps out the resulting shape information from the imported file.
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
PrintVertices(drawingObj.Shapes(1).Vertices)
End Sub
End Sub
The following script is an example of CopyToLayout method that allows placing the shapes from a layout snapshot into
another layout. This allows for options like flattening a layout into a snapshot and then placing it into another layout. It
also allows for editing of the shapes in a snapshot and then placement into a layout. The following code performs multiple
copies with varying justification values and then dumps the details of the resulting layout:
The following script is an example of new method for copying shapes from a layout snapshot to a cell editor. The script
copies a set of shapes obtained from the layout to the cell editor placing them with various orientations at different
locations and then dumps out the resulting shape details:
End Sub
The following code is an example new API snapshot facilities including create snapshot from a cell and copy a snapshot
to another snapshot:
End Sub
Note: we support API method for copying shapes from one snapshot to another to combine them. We provide one
additional copy method which allows shapes from two snapshots to be combined into one. API has the complete the set
of copy operations for snapshot objects in that we can now go from snapshot to cell, snapshot to layout and snapshot to
snapshot. In addition snapshots can be produced from layout and the cell editors. So the results of shape operations
provided for snapshots can be added to layouts and cells and other snapshots.
We recommend using full path such as Project.Path & "Filename.gds" to ensure the file is placed where you want it.
Sub Main
Project.Schematics(1).Layout.Export("Mystery.gds","MMIC GDSII",True)
End Sub
Boundary Object
The Boundary object defines the extents of Shapes within a Layout, Cell, and Drawing object. The Boundary object has
numeric values Right, Left, Top, and Bottom; all the Shapes that comprise the object are located within these extents.
Access to the Net objects is within the Layout views for Schematics. You can also add new nets by using the
CreateRouteRecord and AddRoute methods on the physical net.
The following code shows how to access the Physical Nets FlightLines collection:
index = index + 1
Next fltLine
Next phyNet
Debug.Print
Next schem
Some methods for getting and setting the default route property info through the API. The values can be obtained as in
the following script:
End Sub
The values can be verified by looking at the iNet properties dialog available from the toolbar when a layout is open.
When the values are set they should update the dialog to refect the new settings if it is open.
The properties for segments of a route can be updated by using the segment properties command. The following script
shows how to change a route segment line type:
lay.Update
lay.Refresh
End Sub
End Sub
index = 1
For Each seg In rt.Segments
PrintSegmentDetails seg
Next seg
Debug.Print "-----------------------------------------------"
End Sub
End Sub
seg.LineType = ThickMetal
End If
Next seg
Next rt
End Sub
The HighlightNet method is part of the physical net object and allows you to enable and disable the highlight state of
the net and to set the highlight color.
The following script demonstrates access flight line counts, and layout PCell counts, the information available from the
LayoutInfo object. Often not having any flightlines can be used as a correctness check for a layout so this information
is useful for layout sign-off, having it available directly from the layout info object prevents having to traverse all the
physical nets in the design to see of any of them have remaining flight lines. Cell counts can be hard to determine since
we lump subcircuits and cells into the same collection container typically. The cells count separates the cells from the
sub-circuits and provides a count of just the cells. The layout info sub object is associated with a layout. This object
provides summary information about a layout object. These script enumerates a number of schematic layouts with
different combinations of shapes, routes, sub-circuits, and cell objects and provides summary output information for
each:
End Sub
End Sub
The following script demonstrates how to set the Select property for all Shapes associated with all physical nets to "True".
After the script runs, all net Shapes are selected in Layout:
The following script demonstrates how to set the via mode through the ViaMode property on the physical net object in
the API. The routes on a physical net should update correctly when the via mode is changed. The via mode transitions
can be Full to Minimal, Minimal to Full, Full to Minimal 2 and Minimal 2 to Full:
phys.ViaMode = mwNVM_MinimalVias
lay.Update
lay.Refresh
End Sub
Debug.Print ""
Debug.Print title
Debug.Print ""
For Each rt In phys.Routes
For Each rtVia In rt.Vias
Debug.Print "Via Center = { x = " & rtVia.Origin.x * 1e6 & ", y = " & rtVia.Origin.y * 1e
Debug.Print "Via Extent = { cx = " & rtVia.Extent.cx * 1e6 & ", cy = " & rtVia.Extent.cy
Debug.Print "Via Offset = { dx = " & rtVia.Offset.dx * 1e6 & ", dy = " & rtVia.Offset.dy
Debug.Print "Via Line Type1 = " & rtVia.LineType1
Debug.Print "Via Line Type2 = " & rtVia.LineType2
Debug.Print "Via Conn Type1 = " & rtVia.ConnectType1
Debug.Print "Via Conn Type2 = " & rtVia.ConnectType2
Debug.Print "Via Direct = " & rtVia.Direction
Debug.Print "Via Enabled = " & rtVia.Enabled
Debug.Print "Via Autosize = " & rtVia.AutoSize
End Sub
mwNVM_MinimalVias
mwNVM_FullVias
mwNVM_Minimal2Vias
mwNVM_ManualVias
mwNVM_SemiAutoVias
The following script demonstrates how to change setting for fixed vs. variable radius curves in an iNet route object.If
route with a radius specification that is large enough that the segments require variable radius to curve the bends. The
script sets variable radius so curves changes to straight segments:
Sub Main
Dim lay As Layout
Dim objDraw As DrawingObject
Dim phyNet As PhysicalNet
Dim rt As Route
Debug.Print ""
Debug.Print title
For Each shp In objDraw.Shapes
For Each vtx In shp.Vertices
Debug.Print "Vtx { x = " & vtx.x * 1e6 & ", y = " & vtx.y * 1e6 & " }"
Next vtx
Next shp
Debug.Print ""
End Sub
The PhysicalNet collection of objects includes the Pins and Routes collection of objects.
The PhysicalNet collection of objects has AddRoute() and CreateRouteRecord() methods, and ElectNetName and NetID
properties.
The Route collection of objects has BendStyle, MiterAmount, and NetID properties, and also includes Segments, Guides,
and Objects collections of objects.
You should use EditCopy instead of EditCopyAll, so all selected elements are copied to the Clipboard.
Note that the coordinates to the EditPasteSpecialIncludeRoutes are pasted back into the schematic (rather than the
layout) if the numbers are similar to 10e-6 (which is more for layout) than 1000.
End Sub
API provides a method on the physical net for associating objects that will support associating routes and net shapes.
This method takes a generic API drawing object and attempts to associate the object with the physical net. This allows
re-associating disassociated route objects and net shapes as well as changing their association from one physical net to
another. For dumb shapes the call will attempt to create an equivalent net shape which will then be associated with the
physical net. API supports polygons, paths, and ellipses as associated net shapes.
Debug.Clear
Set lay = Project.Schematics("Schematic 1").Layout
Debug.Print lay.Name
Debug.Print phys.Shapes.Count
Debug.Print phys.Shapes.Count
End Sub
The second approach uses a Disassociate method on the Net shape object itself:
Debug.Clear
Set lay = Project.Schematics("Schematic 1").Layout
Debug.Print lay.Name
You can edit the segment end styles and keep the edits when the Route segment end style is set to "Custom". The API
provides a route.CustomSegmentEnds property, so the script that sets the custom end style can set the flag to retain the
end styles. The script includes the following line before setting the custom end styles:
The following script shows an example of working with Route segment end styles.
Set s = Project.Schematics.ActiveSchematic
If (s Is Nothing) Then
MsgBox("A schematic window must be the active window",vbOkOnly,"Script Error")
End
End If
ReDim listArray(5)
listArray(0) = "Chamfer"
listArray(1) = "Truncate"
listArray(2) = "Extended"
listArray(3) = "Variable"
listArray(4) = "Custom"
func = Dialog(dlg)
'Cancel button
If (func = 0) Then
End
End If
e = dlg.EndStyle
Debug.Print e
End If
Next seg
Next r
Next net
s.Layout.Refresh
End Sub
Because a Drawing object may consist of several shapes that you cannot individually modify, changes are not allowed
to affect the original object. For example, a Path on the Plated Metal line type may consist of three different paths with
different widths drawn over each other. The system does not allow you to edit the three paths individually, but you can
edit the overall Path object. Many of the same attributes are available at the DrawingObject level, so you can modify
them there and they affect the original object.
Next atr
Next dro
lay.Refresh
Debug.Print "TopRight Corner: ("; Project.Schematics(1).Layout.Boundary.Right; ",";Project.Schemat
Debug.Print "BottomLeft Corner: ("; Project.Schematics(1).Layout.Boundary.Left; ",";Project.Schema
End If
Next atr
Next dro
lay.Refresh
lay.Refresh
End Sub
The following script uses a Drawing Object drag handle to perform a Stretch Edit operation. It reads the angle of angled
segments before and after to determine that the angle is retained (within a range of accuracy to prevent round-off errors).
The script also checks to ensure that the stretch offset was performed correctly by verifying the change in position of the
edit handle.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Set objDraw = lay.DrawingObjects(1)
' Check that the mid section angle remained the same (lock-angle)
If (Abs(ang2 - ang1) lt 5) Then
Debug.Print "Left Upward Section Angle Remained The Same"
Else
Debug.Print "Left Upward Section Angle Changed"
End If
Set eh = objDraw.EditHandles(3)
Set eh2 = objDraw.EditHandles(5)
Dim dx As Double
Dim dy As Double
dx = eh2.Position.x - eh.Position.x
dy = eh2.Position.y - eh.Position.y
End Function
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Set objDraw = lay.DrawingObjects(1)
' Check that the mid section angle remained the same (lock-angle)
If (Abs(ang2 - ang1) lt 5) Then
Debug.Print "Left Upward Section Angle Remained The Same"
Else
Debug.Print "Left Upward Section Angle Changed"
End If
The following script prints the positions of the edit handles to see which one is the upper right. Then it calls Move on
that edit handle with that index to stretch the shape. Printing them just helps figure out which edit handle is which, these
are the handles that are displayed when you double click the shape. Once you know which handle you want to change
on a shape it should always be the same for that shape type so you can just use the index. The code looks like this:
Debug.Clear
Set lay = Project.Schematics("Schematic 1").Layout
Set objDraw = lay.DrawingObjects(1)
' Print the handle positions so we can tell which is upper left.
objDraw.EditHandles(2).Move(100e-6, 0)
End Sub
The following script shows an example of adding Route to a physical net in Layout:
Sub Main
Dim lay As Layout
Dim physNet As PhysicalNet
Set lay = Project.Schematics("SCH1").Layout
' Add the routes
For Each physNet In lay.PhysicalNets
AddPhysicalNetRoutes physNet
Next physNet
lay.Update
lay.Refresh
End Sub
x1 = fltLine.Begin.x
y1 = fltLine.Begin.y
x2 = fltLine.End.x
y2 = fltLine.End.y
w = 20e-6
rtRec.AddSegment(x1, y1, xMid, y1, w, 0, mwEST_TruncateEndStyle, 0, mwEST_ExtendedEndStyle, w/2)
rtRec.AddSegment(xMid, y1, xMid, y2, w, 2, mwEST_ExtendedEndStyle, w/2, mwEST_ExtendedEndStyle, w/
rtRec.AddSegment(xMid, y2, x2, y2, w, 0, mwEST_ExtendedEndStyle, w/2, mwEST_TruncateEndStyle, 0)
' From the API perspective Semi-auto behaves like manual so we need to add vias.
' In manual mode we need to add vias ourselves
rtRec.AddVia(xMid, y1, w/2, w/2, 0, 0, 0, 2, mwVDT_Layer1ToLayer2ViaDirection)
rtRec.AddVia(xMid, y2, w/2, w/2, 0, 0, 0, 2, mwVDT_Layer1ToLayer2ViaDirection)
physNet.Routes.AddRoute(rtRec)
End Sub
physNet.Routes.Remove(1)
End Sub
End Sub
Debug.Print "-----------------------------------------------"
End Sub
End Sub
End Sub
index = 1
For Each vtx In vts
Debug.Print "Vertex[" & index & "] = { x = " & vtx.x * 1e6 & ", y = " & vtx.y * 1e6 & " }"
index = index + 1
Next vtx
End Sub
Debug.Clear
Set lay = Project.Schematics("Schematic 1").Layout
For Each physNet In lay.PhysicalNets
For Each rt In physNet.Routes
For Each rtObj In rt.Objects
Debug.Print rtObj.BeginNode & ", ";
Debug.Print rtObj.EndNode
Next rtObj
Next rt
Next physNet
End Sub
1, 3
3, 4
4, 5
5, 6
6, 2
This script replicates the steps; it sub-selects the segments, which is the same as right-click selecting them. It invokes
the SegmentProperties command with arguments to change the segments from Metal 3 to Metal 4, and then it invokes
the EditUndo command to undo the changes. The InvokeCommand method is also described. We need to mention very
important information abou using UNDO method. The only API operations that can be undone are those that involve a
command object. So these are operations that involve InvokeCommand() methods. In our system command objects are
able to undo and redo their operations. In order for Undo or Redo to work we need to start with something that was done
by a command. If the operation wasnt done with InvokeCommand() it is unlikely that undo will work.
Debug.Clear
Set lay = Project.Schematics("Schematic_1").Layout
Set phy = lay.PhysicalNets(1)
lay.InvokeCommand("EditUndo")
End Sub
We can apply for the net route associate and disassociate commands. To do so we can select flightlines associated with
a physical net in the API:
lay.SelectedObjects.RemoveAll
For Each objDraw In lay.DrawingObjects
If objDraw.TypeBits = 64 Then
objDraw.Selected = True
End If
Next objDraw
phys.FlightLines.Selected = True
lay.InvokeCommand("SchematicAssocNetRoutes")
Debug.Print "Physical Net Route Count = " & phys.Routes.Count
lay.SelectedObjects.RemoveAll
For Each objDraw In lay.DrawingObjects
If objDraw.TypeBits = 64 Then
objDraw.Selected = True
End If
Next objDraw
lay.InvokeCommand("SchematicDisassocNetShapes")
Debug.Print "Physical Net Route Count = " & phys.Routes.Count
We support invoking the add route via command via the parametric invoke command API to add vias in manual edit
mode to a route object. The following code adds 4 vias to two different route objects on two different physical nets:
Sub Main
Dim lay As Layout
Dim physNet As PhysicalNet
Dim Route As Route
Dim count As Integer
Dim i As Integer
count = 0
If (lay.PhysicalNets.Count > 0) Then
Set physNet = lay.PhysicalNets(1)
SelectNetRoutes(physNet)
lay.InvokeCommand("SchematicManualAddRouteVia", Array(-110e-6, 85e-6))
lay.InvokeCommand("SchematicManualAddRouteVia", Array(-63e-6, 85e-6))
count = count + 2
End If
lay.SelectedObjects.RemoveAll
lay.Update
lay.Refresh
End Sub
Debug.Print ""
End Sub
End Sub
Debug.Print "-----------------------------------------------"
End Sub
End Sub
End Sub
lay.InvokeCommand("SchematicManualDeleteRouteVia")
The following script is an example of working with Route Via AutoSize property. This property updates the size of the
route vias:
Sub Main
Dim lay As Layout
Dim physNet As PhysicalNet
lay.Update
lay.Refresh
End Sub
Sub ChangeRouteViaToAutoSize(ByRef physNet As PhysicalNet)
Dim rt As Route
Dim seg As RouteSegment
Dim via As RouteVia
End Sub
The following code is an example of working with Route Via extent property. This property updates the extent of the
route vias:
The following code is an example of working with Route Via offset property. This property updates the offset of the
route vias:
The following code is an example of added support for invoking the route via properties command via the API. We added
support for KRouteViaPropertiesCommand to allow the dialog to be bypassed if the command was invoked with arguments
and to obtain the needed via values form the arguments. The via update processing is then completed with the argument
values. The following code selects two routes on different physical nets and then updated the attributes of the included
vias. The state of the vias after the changes can be output with the same manner showed above:
lay.Update
lay.Refresh
The following code shows how to make route property via enabled/disabled:
Sub Main
Dim lay As Layout
Dim physNet As PhysicalNet
Dim Route As Route
lay.Update
lay.Refresh
End Sub
index = 1
For Each rt In physNet.Routes
Debug.Print"Route[" & index & "]"
PrintRouteDetails rt
index = index + 1
Next rt
End Sub
index = 1
For Each via In rt.Vias
Debug.Print"Via[" & index & "]"
PrintViaDetails via
index = index + 1
Next via
Debug.Print"-----------------------------------------------"
End Sub
The following code shows how to access to flight lines associated with specific electrical nets, and to verify flight line
update when element is moved to to disconnected position./disabled:
Sub Main
Dim schem As Schematic
Dim lay As Layout
Dim objDraw As DrawingObject
Dim objFace As Face
End Sub
Debug.Print title
Debug.Print "FlightLines: "
For Each physNet In lay.PhysicalNets
Debug.Print "Net Name = " & physNet.Name
index = 1
For Each fl In physNet.FlightLines
Debug.Print "FlightLine[" & index & "] = From: x = " & fl.Begin.x * 1e6 & ", y = " & fl.Begin.y
Debug.Print " To: x = " & fl.End.x * 1e6 & ", y = " & fl.End.y * 1e6
index = index + 1
Next fl
Next physNet
Debug.Print ""
End Sub
The following code is an example of using the Layout method InvokeCommand() that invokes the name of a specified
command.
The following are further examples of using the Layout method InvokeCommand():
lay.InvokeCommand("EditorAlignTop")
The following is an example of using the Layout method InvokeCommand() for drawing a Circle:
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
Set dl = Project.ProcessDefinitions(1).LayerSetup.DrawingLayers("Poly")
Project.ProcessDefinitions(1).LayerSetup.DrawingLayers.ActiveLayer = dl
Debug.Print "Setting Layer = " & dl.Name
Print #1, "Active Layer = " & Project.ProcessDefinitions(1).LayerSetup.DrawingLayers.ActiveLayer.
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
The following is an example of using the Layout method InvokeCommand() for drawing an Arc:
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
The following code is an example of using the Layout method InvokeCommand() for drawing Layout Ruler:
Set dl = Project.ProcessDefinitions(1).LayerSetup.DrawingLayers("Poly")
Project.ProcessDefinitions(1).LayerSetup.DrawingLayers.ActiveLayer = dl
Debug.Print "Setting Layer = " & dl.Name
Debug.Print "Active Layer = " & Project.ProcessDefinitions(1).LayerSetup.DrawingLayers.ActiveLaye
lay.InvokeCommand("InsertRuler", Array(0, 0, 100e-6, 0, False), ret)
Debug.Print ret
lay.InvokeCommand("ShapeCreateSnapToFit")
The system uses different algorithms for "snap to fit" on routes and for PCell objects. In the user interface, the system
recognizes what is selected and determines which algorithm to invoke. In the API, you need to invoke both algorithms
if you select both iNet Shapes and PCell objects. InvokeCommand() objects in the Layout must be selected before this
operation. The following code selects and then "snaps to fit" both iNet and PCell objects in this test case:
Debug.Clear
Set sch=Project.Schematics(1)
Set lay = sch.Layout
sch.Layout.SelectedObjects.AddFromArea(-65e-6,80e-6,300e-6,-100e-6,mwAAT_ContainedObjects)
' Invoke the SnapToFit on the resulting selected shape.
lay.InvokeCommand("SchematicRouteSnapToFit")
sch.Layout.SelectedObjects.AddFromArea(-205e-6,1550e-6,505e-6,-100e-6,mwAAT_ContainedObjects)
lay.InvokeCommand("ShapeSnapToFit")
lay.Refresh
End Sub
The following code shows how to select all objects from the Area of Layout:
The following code shows how to select all objects in the Layout:
lay.InvokeCommand("SchematicConnectNetShapes")
The following code associates a dumb polygon shape with a physical net. We had some issues with this since the object
that results is not the same as source object (net shape replaces dumb shape) :
lay.SelectedObjects.RemoveAll
For Each objDraw In lay.DrawingObjects
If objDraw.TypeBits = 1 Then
objDraw.Selected = True
End If
Next objDraw
phys.FlightLines.Selected = True
lay.InvokeCommand("SchematicAssocNetRoutes")
The following example of the code uses AssociateObject() method to associate a dumb polygon shape:
lay.SelectedObjects.RemoveAll
For Each objDraw In lay.DrawingObjects
If objDraw.TypeBits = 1 Then
phys.AssociateObject(objDraw)
End If
Next objDraw
The following code associate routes with physical net programmatically without needing to use invoke command. Look
at the picture below that shows the meaning of associating routes with physical net:
lay.SelectedObjects.RemoveAll
For Each objDraw In lay.DrawingObjects
If objDraw.TypeBits = 64 Then
phys.AssociateObject(objDraw)
End If
Next objDraw
The following code Merge linear end-connected routes using invoke command. This command will be useful with
complex routing connections and makes it possible to associate several routes with the flight lines of a single group of
connections. Look at the picture below that shows the meaning of merging routes. There are two routes in the picture.
After the merge command it will be one route:
lay.SelectedObjects.RemoveAll
' Selection order matters so select all routes from one net first.
Set phys = lay.PhysicalNets("ELENET2.EN1")
For Each rt In phys.Routes
rt.Selected = True
Next rt
lay.Update
lay.Refresh
The following code shows via fence operations around route objects, using InvokeCommand() Method. The operations
include adding fencing around the perimeter of a route object, adding them with the perimeters merged and adding them
with the perimeters merged and an offset. Invoking the Via Fill or Via Fence commands via the Invoke Command API
method now requires an additional argument to determine if the results should be grouped:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
End Sub
Debug.Print ""
Next objDraw
Debug.Print ""
End Sub
The similar operation using InvokeCommand() Method could apply for ViaFill
The following code shows how to Add cells by specifying the settings :
End Sub
We have enabled the API drawing object group collection to access objects inside the group object. Invoking the Via
Fill or Via Fence commands via the Invoke Command API method now requires an additional argument to determine
if the results should be groupped:
Sub Main
' Code Module
Dim lay As Layout
Dim ret As Variant
Dim objDraw As DrawingObject
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeViaFill", Array("ViaLib", "ViaCell", 0, 15e-6, 15e-6, 0, 0, 5e-6, 0, 1), r
lay.InvokeCommand("EditUndo")
lay.InvokeCommand("EditRedo")
End Sub
These script invokes the Via Fill command on a number of shape types and requests that the command group the resulting
vias. The details of the results are then dumped out. The script traverses into the grouped objects during the the object
output dump to see the contents of the group objects
The following code shows how to work with many-path crossover insertion. Layout includes a route intersection between
three different routes and the code will attempt to insert two crossovers as an example of handling many path intersection.
The code uses InvokeCommand "SchematicNetCleanup" :
Sub Main
lay.SelectedObjects.RemoveAll
' Selection order matters so select all routes from one net first.
Set phys = lay.PhysicalNets("ELENET2.EN2")
For Each rt In phys.Routes
rt.Selected = True
Next rt
lay.Update
lay.Refresh
lay.InvokeCommand("EditUndo")
End Sub
Next phys
Debug.Print "----------"
End Sub
The Net Cleanup command takes three arguments when invoked by the InvokeCommand method in the API. We have
an option to add routes incrementally so the third argument in InvokeCommand allows specifying this option for the
command.
The following script shows how to insert crossover inrementally.The code inserts two crossovers in the same line selecting
the routes in pairs and invoking the command twice to insert the two crossovers. It depends on the incremental add option
working correctly to not remove the first crossover when inserting the second. We also have Undo and Redo methods
of the incremental add:
Sub Main
Dim lay As Layout
Dim phys As PhysicalNet
Dim rt As Route
lay.SelectedObjects.RemoveAll
' Selection order matters so select all routes from one net first.
Set phys = lay.PhysicalNets("ELENET2.EN2")
For Each rt In phys.Routes
rt.Selected = True
Next rt
lay.Update
lay.Refresh
lay.SelectedObjects.RemoveAll
lay.Update
lay.Refresh
End Sub
The following script uses the InvokeCommand ("EditPaste", args, res) method for invoking the Copy/ Paste command.
The following script uses the InvokeCommand( "EditCopyWithReference") that just copies a rectangle object and offsets
it by 200um. The parametric arguments include start point, end point, rotation ccw and flip. The API call will imitate
RButton down clicks for rotation ccw and flip during the dragging stage:
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
PrintDrawObjectsState lay, "Before Copy Command"
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditCopyWithReference", Array(0, 0, 200e-6, 0, 0, True))
PrintDrawObjectsState lay, "After Copy Command"
lay.InvokeCommand("EditUndo")
PrintDrawObjectsState lay, "After Copy Command Undo"
lay.InvokeCommand("EditRedo")
PrintDrawObjectsState lay, "After Copy Command Redo"
Copy with reference provides a shortcut for copy/paste in that you can copy something move to a new location and then
place it immediately. But it also places the objects on the clipboard which allows you to move to another location and
then paste again with the standard Paste command or Ctrl + V the resulting objects being moved by the same reference
point as the originals. This can be used to quickly stamp down a number of instance copies of an collection of shapes
and place them precisely by a given reference point.
The following script is the example of copy something move to a new location and then place it immediately:
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditCopyWithReference", Array(0, 0, 200e-6, 0, 0, False))
Copy with reference command can also be applied to schematic and system diagram views.
The following script uses the InvokeCommand( "EditCut") that correctly removes objects from the design and places
them on the clipboard so that they can be pasted into a new design:
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditCut")
You can also use the InvokeCommand("EditDelete") that also removes objects from the layout design.
The following script uses the InvokeCommand ("PasteRelative()" method for both the API Layout object and API
EMStructure object to support pasting relative to the original location. Normal paste uses the upper left base position as
the absolute xy coordinate for placement.
cellEditor1.SelectedObjects.AddAll
cellEditor1.CopyToClipboard
If cellEditor2.CanPaste Then
cellEditor2.PasteRelative(25e-6, 25e-6) ' Paste at different location than original
cellEditor2.PasteRelative(50e-6, 50e-6) ' Paste a second time different location
End If
cellEditor2.Update
cellEditor2.Refresh
Debug.Print cellEditor2.Name
Debug.Print "DrawingObjects Count = " & cellEditor2.DrawingObjects.Count
For Each objDraw In cellEditor2.DrawingObjects
PrintDrawingObject objDraw
Debug.Print""
Next objDraw
Close #1
Sub PrintDrawingObject(ByRef drawingObj As DrawingObject)
Debug.Print"Info Text = " & drawingObj.InfoText
Debug.Print"Selected = " & drawingObj.Selected
Debug.Print"Flipped = " & drawingObj.Flipped
Debug.Print"Rotation = " & drawingObj.RotationAngle
Debug.Print"Frozen = " & drawingObj.Frozen
Debug.Print"Base Pos = { x = " & drawingObj.BasePosition.x & ", y = " & drawingObj.BasePosition.y
Debug.Print"Layer Map = " & drawingObj.LayerMapping
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
The following script is invoking the export schematic layout command from the API schematic object:
GotError:
If bError Then
Debug.Print "Encountered Error Exporting GDS file."
Else
Debug.Print "No error encountered Exporting GDS file."
End If
The following script is invoking the export schematic layout command from the API schematic object as DXF file:
The arguments are packed in an array of variants. If the command fails, the "res" argument (which is the return value)
should contain a string that provides the syntax details for the arguments to the command. This can help with any necessary
debugging.
Debug.Print res
"Error: Invalid Arguments, Usage: EditPaste( VARIANT argArray ), where argArray = Array(double xPo
NOTE: Both 'argArray' and 'res' are optional, although if the command needs the arguments it fails if they are not
provided in a variant array.
The following script uses the InvokeCommand(InsertExtractionPort) method to add Edge Extraction Port. The comand
uses an arguments array.
Sub Main
Dim emp As EMPort
Dim lay As Layout
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
lay.DrawingObjects(1).Selected = True
lay.InvokeCommand("InsertExtractionPort", Array(0.0, 0.0, 0.0, 100e-6))
lay.InvokeCommand("InsertExtractionPort", Array(100e-6, 0.0, 100e-6, 100e-6))
Debug.Print lay.Name
End Sub
Debug.Print Title
For Each vtx In verts
Debug.Print "{ x = " & vtx.x & ", y = " & vtx.y & " } "
Next vtx
End Sub
The following script uses InvokeCommand(ShapeStretch) method to work with Layout Polygon. Since both the vertex
definition area and the offset have to be specified for this command invocation to work, this one is a little more complicated
script:
Sub Main
Dim lay As Layout
Dim ret As Variant
Dim dl As DrawingLayer
Dim objDraw As DrawingObject
Dim objRect As DrawingObject
Dim bFound As Boolean
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
End If
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
The following is the basic implementation of stretch command invocation from API using parametric InvokeCommand
api:
Debug.Clear
Set lay = Project.Schematics("Schematic 1").Layout
lay.SelectedObjects.AddAll
' Arguments are (x1, y1, dx, dy) where x1 and y1 are xy coordinates of drag handle to stretch.
' dx and dy are how much to move drag handle
End Sub
In the following script we added two points to the Path and stretching them:
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeEditPoints", Array("AddPoint", 25e-6, 0))
lay.InvokeCommand("ShapeEditPoints", Array("AddPoint", 75e-6, 0))
' Arguments for Stretch Area are (left, top, right, bottom, deltaX, deltaY)
lay.InvokeCommand("ShapeEditPoints", Array("StretchArea", 20e-6, 20e-6, 80e-6, -20e-6, 0, 20e-6))
End Sub
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeEditPoints", Array("AddPoint", 25e-6, 0))
The following script uses the InvokeCommand(SchematicMakeGdsCell) method for creating GDS Cells. The arguments
array is different here.
lay.InvokeCommand("SchematicMakeGdsCell",arg,pRet)
Debug.Print pRet
End Sub
The following script uses the InvokeCommand(CellFlatten) method for flatten artwork Cells. There is no arguments
here.The usage statement indicates that the flatten level argument is optional however the logic in the command required
that a flatten level integer be passed into the argument array when invoking the command. If no flatten level is provided
INT_MAX is used as the flatten level.
The following script uses the InvokeCommand("SchematicAssociateCell") method for associating pCells with Elements.
The Arguments array is the Elements name.
For i = 1 To schem.Elements.Count
lay.SelectedObjects.RemoveAll
lay.DrawingObjects(i).Selected = True
eleName = schem.Elements(i).Name
lay.InvokeCommand("SchematicAssociateCell", Array(eleName))
Next i
End Sub
Debug.Print title
For Each elem In schem.Elements
Debug.Print elem.Name & " has cell = " & elem.HasLayoutCell
Next elem
End Sub
The following script uses the InvokeCommand ("EditorSpaceEvenlyVertical", args, res) method for invoking the
Draw/Align Shapes/Space Evenly Down command.
Debug.Clear
lay.SelectedObjects.AddAll
centerToCenter = 1
' edgeToEdge = 1
Debug.Print var2
End Sub
In this example, the value 10e-6 is the spacing. You should select the objects you want to space, as shown in the script.
This script also includes a Print command for the return variable "var2". If there is a problem with the values a usage
statement is included in the return variant to help with debugging.
The following script uses the InvokeCommand ("EditMirror",args) method for invoking the Mirror command. The
arguments for this are x1, y1, x2, y2 of the mirror line. To execute the ("EditMirror",args) method we need to select all
drawing objects in layout. Before using the command we need to specify the type of drawing objects we want to apply
the mirror command (no need for Artwork Cell, Path, or MLIN Elenents for EMStructure layout). For example for the
polygon the type will be 65, for the net route it will be 64. To find out the type of drawing object we should use the
following code:
End Sub
After identifying the type of the objects we can use the following script for the Mirror:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
If objDraw.TypeBits = 64 Then
objDraw.Selected = True
End If
Next objDraw
End Sub
Debug.Print title
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
End Sub
The following scripts show invoking the generic any angle rotation command from the API and specifying a specific
rotation point and angle. The first script shows how to rotate pCell:
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditRotate", Array(0.0, 0.0, 90), ret )
The second script shows how to rotate polygon using drawing objects (we support any arbitrary rotation):
Sub Main
Dim lay As Layout
Dim objDraw As DrawingObject
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
lay.Refresh
End Sub
Debug.Print title
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
The third script shows how to rotate net route using InvokeCommand method:
Sub Main
Dim lay As Layout
Dim ret As Variant
Dim objDraw As DrawingObject
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
lay.InvokeCommand("EditUndo")
lay.InvokeCommand("EditRedo")
End Sub
See previous code for the PrintDrawObjectsState(ByRef lay As Layout, title As String) subroutine.
The following script uses the InvokeCommand ("CellFlatten",args, res) method for invoking the Draw/Flatten Cell
command.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
lay.SelectedObjects.AddAll
lay.InvokeCommand("CellFlatten", Array(1000))
The following script uses the InvokeCommand ("EditFlip",args) method for invoking the Flip command for pCell,
artwork Cell, mosaic artwork cells:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditFlip", Array(250e-6, -10e-6, 250e-6, 200e-6))
The following script uses the InvokeCommand ("ShapeMakePolygon") method. This command converts various higher
level shapes into basic polygon equivalents. It can be used to convert ellipses, circles, and paths into polygons. It can
also be used to fill Arcs and convert closed or nearly closed polylines into filled polygon equivalents. This command
works correctly on a range of objects including net associated objects and retains the association during the conversion.
It is available for Ellipses, Paths, Arcs, Net Ellipses, and Net Paths in NI AWR DE GUI. The menu item for it is on Draw
-> Modify Shapes -> Make Polygon. The command in API looks like:
lay.SelectedObjects.RemoveAll
For Each objDraw In lay.DrawingObjects
If (objDraw.TypeBits = 65) Then
objDraw.Selected = True
End If
Next objDraw
The following script uses the InvokeCommand ("InsertPolygon") method. This command draw a polygon on the certain
layer. The command in API looks like:
Set dl = Project.ProcessDefinitions(1).LayerSetup.DrawingLayers("Poly")
Poly_on_Layer lay, dl
End Sub
Sub Poly_on_Layer(ByRef lay As Layout, dl As DrawingLayer)
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
Project.ProcessDefinitions(1).LayerSetup.DrawingLayers.ActiveLayer = dl
Debug.Print "Setting Layer = " & dl.Name
Debug.Print "Active Layer = " & Project.ProcessDefinitions(1).LayerSetup.DrawingLayers.ActiveLaye
Debug.Print ret
End Sub
The collection of Faces objects in Layout is associated with the DrawingObjects collection. The following script explores
all DrawingObjects, collections of Faces, and Faces properties:
The following is additional general code showing the API access to each of the properties associated with the Faces of
a Layout drawing object:
End Sub
This script shows how to access Face properties. You can set the properties to a desired value.
The additional properties for Face and Pin objects include connect type, face shape type, group number, group type, and
whether the area portion of a pin is enabled for connection.
The following code finds the vertices of the Schematic ports using the Faces collection of objects:
If the GDS cell associated with a model has two cell faces, both assigned to one port, use the following script:
Sub Main
Debug.Clear
Dim e As Element
Dim f As Face
Set e = Project.Schematics(1).Elements(1)
Debug.Print "Num Faces: " & e.DrawingObjects(1).Faces.Count
For Each f In e.DrawingObjects(1).Faces
Debug.Print "PortNum: " & f.PortNumber & " SubPortNum: " & f.SubPortNumber
Next f
End Sub
Num Faces: 2
PortNum: 1 SubPortNum: 1
PortNum: 1 SubPortNum: 2
The NI AWR SDE has many properties for the Face object, including:
AreaEnabled
connectType
DrawingLayer
ElementName
GroupNumber
GroupType
Type
The SnapToObject is set in a manner similar to that given in the Cell Options dialog box Faces tab Snap to option. In
this dialog box the name of the Element is a combination of the Element type and the Element ID. This is followed by
a ":" colon and the preferred node number. So, for example, a Thin Film capacitor might be specified as "TFC.V1:1",
meaning Thin Film Capacitor, ID="V1" and the preferred node=1. Another example is for the second node of a MLIN
"MLIN.TL2:2", meaning an MLIN element ID=TL2 and preferred node=2.
With this addition, you can automatically set the face offset to make the rat line go away. This is a very difficult task in
the user interface, because you must understand a coordinate transform to do it correctly.
The following code shows how to set SnapToObject using the Faces collection of objects:
End Sub
Note that the node number index basis is 1 (not zero), to be consistent with the user interface.
The following code shows that changes to the Face Alignment property result in changes to the Face Connection location.
This code sets the Face Alignment to several values:
objFace.Alignment = mwFA_Left
objFace.Alignment = mwFA_Right
objFace.Alignment = mwFA_Center
End Sub
Debug.Print title
Debug.Print "FlightLines: "
For Each physNet In lay.PhysicalNets
Debug.Print "Net Name = " & physNet.Name
index = 1
For Each fl In physNet.FlightLines
Debug.Print "FlightLine[" & index & "] = From: x = " & fl.Begin.x & ", y = " & fl.Begin.y;
Debug.Print " To: x = " & fl.End.x & ", y = " & fl.End.y
inde = index + 1
Next fl
Next physNet
Debug.Print ""
End Sub
The following code shows interface for accessing the adjacent objects from a face object. This allows the user to
programmatically determine the objects that can be set as the snap-to object for a given face:
End Sub
Debug.Print title
The following code offsets a face from its base position, prints the flight line state, updates the offset, and then prints the
resulting state of the flight lines to determine if the face offset was performed correctly:
objFace.Offset.dy = 10e-6
objFace.Alignment = mwFA_OffsetFix
objFace.Offset.dy = 0
objFace.Alignment = mwFA_Center
End Sub
Debug.Print title
Debug.Print "FlightLines: "
For Each physNet In lay.PhysicalNets
Debug.Print "Net Name = " & physNet.Name
index = 1
For Each fl In physNet.FlightLines
Debug.Print "FlightLine[" & index & "] = From: x = " & fl.Begin.x & ", y = " & fl.Begin.y;
Debug.Print " To: x = " & fl.End.x & ", y = " & fl.End.y
inde = index + 1
Next fl
Next physNet
Debug.Print ""
End Sub
The following code finds connection points between flight lines and faces. Having the flight line end point we can
compare that with the pins or faces associated with the physical net or drawing to figure out which one is the correct one
by position. The connection point represents an estimate of where the flight line would connect to a face if there is one.
We can use connection point property to the face API object. API gives us an access to a connection point vertex object
accessible from the face object to provide an indication of the default connection point for the face. The connection point
should represent the location where the flight line is likey to connect to the face if the face is not matched to another
face. Note that for nodes with multiple faces there will be a connection point on each face but the flight lines will connect
to the connection points on the closest faces. In the following script we use a dictionary to try to identify which elements
are connected via a flightline. The dictionary can only take a single argument so the script takes the coordinates for the
connection point and computes a cantor pair key and uses that for the dictionary key. In the elements display the number
after the : should be the face index that is connected.You can see it in the bottom of the output:
' Create a mapping between the face points and the element names
' Dictionary can only handle single value key so compute key from pair of coordinates
Debug.Clear
Set schem = Project.Schematics("s1")
For Each elem In schem.Elements
Debug.Print elem.Name
For Each objDraw In elem.DrawingObjects
index = 1
For Each objFace In objDraw.Faces
If (objFace.Connected) Then
End If
index = index + 1
Next objFace
Next objDraw
Next elem
' Traverse flight lines compute matching key and if there is a match in diction ary get element na
Debug.Print
Debug.Print "FlightLines"
Dim physNet As PhysicalNet
Dim fltLine As FlightLine
For Each physNet In schem.Layout.PhysicalNets
For Each fltLine In physNet.FlightLines
Debug.Print "Flight Line = {" & fltLine.Begin.x * 1e6 & ", " & fltLine.Begin.y * 1e6 & "}";
Debug.Print ", {" & fltLine.End.x * 1e6 & ", " & fltLine.End.y * 1e6 & "}"
' use 1e7 here to allow one decimal place of precision in key.
key = CalcCantorPairing(fltLine.Begin.x * 1e7, fltLine.Begin.y * 1e7)
If (dict.Exists(key)) Then
Debug.Print "From: " & dict(key)
End If
' use 1e7 here to allow one decimal place of precision in key.
key = CalcCantorPairing(fltLine.End.x * 1e7, fltLine.End.y * 1e7)
If (dict.Exists(key)) Then
Debug.Print "To: " & dict(key)
End If
Next fltLine
Next physNet
End Sub
' https://en.wikipedia.org/wiki/Pairing_function
Function CalcCantorPairing(k1 As Long, k2 As Long) As Long
CalcCantorPairing = (1/2)*(k1+k2)*(k1 + k2 +1) + k2
End Function
TFCM.TL5
Connect Point = {94, 22} Key = 673600
Connect Point = {72, 44} Key = 673820
Connect Point = {72, 0} Key = 259560
Connect Point = {50, 22} Key = 259780
TFCM.TL6
Connect Point = {4, 22} Key = 34150
Connect Point = {22, 40} Key = 192910
Connect Point = {22, 4} Key = 33970
Connect Point = {40, 22} Key = 192730
FlightLines
The following script adds EM ports to the MLIN element where the faces are located. It does not add them to the dumb
shape.
Debug.Clear
Debug.Print emprt.Deembed;vbTab;emprt.GroupNumber;vbTab;emprt.GroupType
Debug.Print emprt.Excitation.Angle;vbTab;emprt.Excitation.Imaginary;vbTab;emprt.Excitation.Magni
Debug.Print "Port Number = ";emprt.Number ;vbTab;emprt.Thickness
Debug.Print emprt.Impedance.Angle;vbTab;emprt.Impedance.Imaginary;vbTab;emprt.Impedance.Magnitud
Debug.Print emprt.Termination.ExcitationAngle;vbTab;emprt.Termination.ExcitationPort;vbTab;emprt
Debug.Print emprt.Termination.Impedance.Angle;vbTab;emprt.Termination.Impedance.Imaginary;vbTab;
Debug.Print emprt.Termination.ExcitationPort
Debug.Print emprt.Conductor
Debug.Print emprt.EntityID
Debug.Print emprt.Flags
Debug.Print emprt.Layer
Debug.Print emprt.NetID
Debug.Print emprt.PhysicalThickness
Debug.Print emprt.ReferencePlaneDist
For Each ver In emprt.Vertices
Debug.Print ver.x;vbTab;ver.y
Next ver
Next emprt
Next objDraw
End Sub
Drawing object
Ports count = : 0
Drawing object
Ports count = : 0
Drawing object
Ports count = : 2
True 0 0
0 0 0 0
Port Number = 2 0
0 0 50 50
0 False 1
0 0 50 50
False
1
0
0
0
0
0
0.0001 0.00004
0.0001 0
0.0001 0.00004
0.0001 0
0.0001 0.00004
True 0 0
0 0 1 1
Port Number = 1 0
0 0 50 50
0 True 1
0 0 50 50
True
0
0
0
0
0
0
0 0
0 0.00004
0 0
0 0.00004
0 0
Drawing object
Ports count = : 0
The following provides access to layout extraction ports, setting the port excitation values for an EM port through the
excitation imaginary values and through the port termination properties, using the API impedance complex value interface.
Script also provides port information.
Sub Main
Dim lay As Layout
End Sub
Debug.Print Title
End Sub
Debug.Print Title
For Each vtx In verts
Debug.Print "{ x = " & vtx.x & ", y = " & vtx.y & " } "
Next vtx
End Sub
Sub Main
Dim lay As Layout
emp.Termination.ExcitationAngle = ang
emp.Termination.ExcitationSignalSize = mag
End If
Next emp
Next objDraw
End Sub
There are two methods for adding cells, AddCell() and AddLayoutCell(). The AddCell() method adds an artwork cell
from a project library.
The following script adds PCell object directly to layout without having to specify an element in the schematic side. For
example, MLIN cell could be created with the following code:
Sub Main
Dim lay As Layout
Dim objDraw As DrawingObject
End Sub
We can obtain unit type of layout cell from the parameter objects of a layout drawing object:
Debug.Print Project.Schematics(1).Layout.DrawingObjects(1).Parameters(1).UnitType
Constants that define different type of units are in the following table:
We can add the parameter objects to a layout drawing object with the following code:
Be aware of read-only method for the layout parameters collection that allows API users to determine which objects can
have parameters added or removed and which cannot.
NOTE:The NI AWR SDE does not log events executed via script, so you cannot rely on Undo/Redo operations after
manual changes to a Layout.
The NI AWR SDE allows some Boolean operations via the InvokeCommand():
To copy an Array:
' Select top shape and array copy center to center r3,c5 dx=40 dy=50
lay.SelectedObjects.AddFromArea(-90e-6,40e-6,-50e-6,75e-6,mwAAT_ContainedObjects)
lay.InvokeCommand "ShapeArrayCopy", Array(5,3,40e-6,50e-6,0)
To create a Ring:
To Resize:
To Resize Copy:
To Smooth:
To Subtract:
lay.SelectedObjects.AddFromArea(-2e-6,-1e-6,4e-6,-7e-6,mwAAT_ContainedObjects)
lay.SelectedObjects.AddFromArea(1e-6,-4e-6,7e-6,-10e-6,mwAAT_ContainedObjects)
' Invoke the ShapeIntersect on the resulting selected shapes.
lay.InvokeCommand("ShapeSubtract")
To Union:
To Fructure:
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeFracture", Array(3)) ' Tesselate the rectangles.
To Notch:
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeNotch", Array(100e-6, 150e-6, 200e-6, 50e-6)) ' Notch rectangle.
We support both the Notch-In and Notch-Out behavior of the command similar to the way the UI does. In case the upper
end of the notch region such that it is inside the large open region and the result would be that the command does a
notch-out rather than a notch-in meaning that it will add material to the white region rather than removing it.The following
code provides the coordinates such that the ending point is outside the polygon which for the command indicates that
the action should be a notch-out
To Notch out:
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeNotch", Array(100e-6, 50e-6, 200e-6, -50e-6)) ' Notch rectangle.
Debug.Clear
Set lay = Project.Schematics("Schematic 1").Layout
You can invoke a command that perform a Segment Properties command on a selected Route or set of Routes:
Debug.Clear
Set lay = Project.Schematics("Schematic_1").Layout
Set phy = lay.PhysicalNets(1)
lay.InvokeCommand("EditUndo")
End Sub
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeEditPoints", Array("AddPoint", 25e-6, 0))
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeEditPoints", Array("DeletePoint", 25e-6, 0))
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeEditPoints", Array("AddPoint", 25e-6, 0))
lay.InvokeCommand("ShapeEditPoints", Array("AddPoint", 75e-6, 0))
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeEditPoints", Array("AddPoint", 25e-6, 0))
lay.InvokeCommand("ShapeEditPoints", Array("AddPoint", 75e-6, 0))
' Arguments for Stretch Area are (left, top, right, bottom, deltaX, deltaY)
lay.InvokeCommand("ShapeEditPoints", Array("StretchArea", 20e-6, 20e-6, 80e-6, -20e-6, 0, 20e-6))
This script replicates the steps by sub-selecting the segments (the equivalent of right-clicking them), invoking the
SegmentProperties command with arguments to change the segments from Metal 3 to Metal 4, and then invoking the
EditUndo command to undo the changes. So, the Segment Properties command is able to take arguments. Note that in
the script we also show an access to the route segment line type.
To Slice large polygons (this script tries to invoke ShapeSplit until the smallest shape is < = 8 vertices):
Else
y1 = (t+b)/2 : y2 = y1
x1 = l : x2 = r
End If
Dim retval
sch.Layout.SelectedObjects.AddAll
sch.Layout.InvokeCommand("ShapeSlice", Array(x1, y1, x2, y2), retval)
If retval "" Then Debug.Print retval
sch.Layout.SelectedObjects.RemoveAll
End Function
Note that this example modifies the collection over which it is iterating. The Slice operation makes one shape become
two shapes in the Drawing objects collection, but this is also the collection used for the iteration. In this case it works,
but means that underneath the API you are rebuilding the Drawing objects collection for each iteration. For large numbers
of shapes this can be slow. An alternative might be to create an Array and then re-dimension it to the required size and
load it with references to the shapes to be sliced, and then use that as the source for the iteration. Once it is complete,
re-dimension again and reload for the next pass. This process rebuilds the Drawing objects collection only once per pass
instead of after each slice.
To use the Stretch command for moving PCells and artwork cells when fully enclosed:
rcLeft = 50e-6
rcTop = 100e-6
rcRight = 150e-6
rcBottom = -50e-5
dx = 50e-6
dy = 0
Debug.Clear
Set lay = Project.Schematics("Schematic 1").Layout
lay.SelectedObjects.AddAll
lay.InvokeCommand("ShapeStretch", Array(rcLeft, rcTop, rcRight, rcBottom, dx, dy), ret)
Debug.Print ret;
End Sub
The first four arguments are the vertex selection rectangle and the last two arguments are the delta values for the Stretch.
In the example, this stretches one shape that is partially enclosed and moves a PCell object that is fully enclosed. NOTE:
For more complicated cases (such as ruler and dimensions lines), because of the complexity of the MultiStretch command,
appropriate API commands for stretching are not included.
To determine the correct command name to Invoke, use the following script:
Do not use InvokeCommand("EditorMakeSameSize/ Height/ Width"); you can use this command in scripts with rectangular
dumb Shapes only.
In the NI AWRDE, from an EM Layout or a Schematic Layout you can access Shape Modifiers and their options via
the API.
There is more than one way to access the shapes associated with a modifier.
The following script accesses the objects through the Modified objects collection on the Modifier, and prints the attributes
for each Drawing object:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
The following script accesses the Graphic object for the Shape Modifier and prints the attributes of the Graphic object:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
The following is another example of using a Graphic object for a Shape Modifier:
rec.ShapeVertices.Add(-100e-6, 50e-6)
rec.ModifyObjects.Add(lay.DrawingObjects(1))
rec.ModifyObjects.Add(lay.DrawingObjects(2))
rec.ParamFramePosX = -50e-6
rec.ParamFramePosY = 150e-6
lay.ShapeModifiers.AddModifier(rec)
End Sub
PrintParameters(shapeMod.Parameters)
PrintAttributes(shapeMod.Attributes)
PrintBoundary(shapeMod.Boundary)
PrintVertices(shapeMod.Vertices)
End Sub
The following script accesses the attributes of the object associated with the Shape Modifier. When you select a modifier,
a cross-highlight is used to show the objects that are associated with the Modifier by marking the objects to draw
themselves as "Marked". This typically includes a dashed green outline around the shapes, although for the Modifiers
additional highlight information is sometimes provided with a cyan line. In both cases the object is marked for display
as "Marked". The Drawing object now includes a property for the DisplayMode that takes an argument to indicate for
which mode you want to check. Many Shape Modifiers are associated with objects they modify, and this relation is
represented by the ModifyObjects collection available from the ShapeModifier. Some modifiers such as the Array
Modifier, however, also generate shapes. A new collection provides access to any shapes generated by the modifier. The
Array Modifier has shapes in the Generated Shapes collection if either the rows or columns value is greater than 1.
The following code shows how to use these to determine if the shapes (modified and generated) associated with a Shape
Modifier are set to draw as "Marked" via the DisplayMode property. The following script shows an example of working
with an Array Modifier and displays if associated and generated shapes are set to draw marked:
' Print display mode for the generated array elements (The extras (not originals).
For Each objDraw In shpMod.GeneratedObjects
Debug.Print "Display Mode Object Marked = " & objDraw.DisplayMode(mwDMT_ObjectMarked)
Next objDraw
' Print display mode for the generated array elements (The extras (not originals).
For Each objDraw In shpMod.GeneratedObjects
Debug.Print "Display Mode Object Marked = " & objDraw.DisplayMode(mwDMT_ObjectMarked)
Next objDraw
End Sub
The following is another example of using the new display mode to show that associated objects are marked when the
Shape Modifier is selected:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Print #1, lay.Name
Print #1, "Modifier Count = " & lay.ShapeModifiers.Count
For Each shapeMod In lay.ShapeModifiers
Print #1, "Objects for ShapeModifierId = " & shapeMod.MessageId
For Each objDraw In shapeMod.GeneratedObjects
PrintDrawingObjectDisplayMode objDraw
Next objDraw
Print #1, ""
Next shapeMod
Close #1
End Sub
The following code shows how to work with the objects produced by an Array Modifier working on an iNet route object
with vias:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Print #1, lay.Name
Print #1, "Modifier Count = " & lay.ShapeModifiers.Count
For Each shapeMod In lay.ShapeModifiers
Print #1, "Objects for ShapeModifierId = " & shapeMod.MessageId
For Each objDraw In shapeMod.GeneratedObjects
PrintDrawingObject objDraw
Next objDraw
Print #1, ""
Next shapeMod
Close #1
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
The following code shows how to work with Undo and Redo support in the API for the Modifier command:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
Close #1
End Sub
Dim x1 As Double
Dim y1 As Double
Dim x2 As Double
Dim y2 As Double
Dim xl As Double
Dim yl As Double
Dim ret As Variant
x2 = 0.0
y2 = 100.E-6
x1 = 100.E-6
y1 = 100.E-6
xl = 50.E-6
yl = 150.E-6
lay.DrawingObjects(1).Selected = True
lay.InvokeCommand("SchematicEdgeModifier", Array(x1, y1, x2, y2, xl, yl), ret)
End Sub
x1 = 0.0
y1 = 0.0
x2 = 100.E-6
y2 = 0.0
xl = 50.E-6
yl = 50.E-6
lay.DrawingObjects(1).Selected = True
lay.InvokeCommand("SchematicWidthModifier", Array(x1, y1, x2, y2, xl, yl), ret)
End Sub
rec.ShapeVertices.Add(pt1.x, pt1.y)
rec.ShapeVertices.Add(pt2.x, pt2.y)
rec.ModifyObjects.Add(lay.DrawingObjects(1))
rec.ParamFramePosX = 50e-6
rec.ParamFramePosY = 50e-6
lay.ShapeModifiers.Add(rec)
End Sub
The next code shows how to change the order Index for Edge Modifier for the example in the following picture:
lay.ShapeModifiers("EDGEMOD.EM12").OrderIndex = 1
End If
rec.ShapeVertices.Add(pt1.x, pt1.y)
rec.ShapeVertices.Add(pt2.x, pt2.y)
rec.ModifyObjects.Add(objDraw1)
rec.ModifyObjects.Add(objDraw2)
rec.ParamFramePosX = 150e-6
rec.ParamFramePosY = 150e-6
lay.ShapeModifiers.Add(rec)
End Sub
x1 = 50.0e-6
y1 = 50.0e-6
x2 = 150.0e-6
y2 = 150.0e-6
lay.DrawingObjects(1).Selected = True
lay.InvokeCommand("SchematicRadiusModifier", Array(x1, y1, x2, y2), ret)
End Sub
x1 = 100.0e-6
y1 = 50.0e-6
x2 = 150.0e-6
y2 = 150.0e-6
lay.DrawingObjects(1).Selected = True
lay.InvokeCommand("SchematicEllipseSizeModifier", Array(x1, y1, x2, y2), ret)
End Sub
x1 = -50e-6
y1 = 50e-6
If (shapeMod.Parameters.Exists("LIB")) Then
shapeMod.Parameters("LIB").ValueAsDouble = 12 ' Should be Top Metal
End If
If (shapeMod.Parameters.Exists("LIR")) Then
shapeMod.Parameters("LIR").ValueAsDouble = 10 ' Should be Nitride Etech
End If
End If
End Sub
x1 = -50e-6
y1 = 50e-6
If (shapeMod.Parameters.Exists("OFX")) Then
shapeMod.Parameters("OFX").ValueAsDouble = 50e-6
End If
If (shapeMod.Parameters.Exists("OFY")) Then
shapeMod.Parameters("OFY").ValueAsDouble = 50e-6
End If
If (shapeMod.Parameters.Exists("LI")) Then
shapeMod.Parameters("LI").ValueAsDouble = 7 ' Should be Cap Bottom
End If
End If
End Sub
x1 = -50e-6
y1 = 50e-6
If (shapeMod.Parameters.Exists("LI")) Then
shapeMod.Parameters("LI").ValueAsDouble = 7 ' Should be Cap Bottom
End If
End If
End Sub
x1 = -150e-6
y1 = 50e-6
If (shapeMod.Parameters.Exists("DY")) Then
shapeMod.Parameters("DY").ValueAsDouble = -20e-6 ' Should be Top Metal
End If
End If
End Sub
This code verifies that the collection method Exits and the GetItem methods index into the collections correctly when
presented with the value supplied by the Name property as an index:
Next shapeMod
End Sub
This code shows how the rules are set and the placed instances should update to reflect the processing being performed
by the new rules:
Sub Main
Dim lay As Layout
Dim lay2 As Layout
Dim shapeMod As ShapeModifier
rules = "BOOLEAN_OPS ""Temp1"" ""Thick Metal"" OR ""Cap Bottom""" & vbCr &
vbLf & "LDELETE ""Cap Bottom""" & vbCr & vbLf & "Replace ""Thick Metal"" ""Temp1"""
End Sub
Debug.Print title
For Each objDraw In lay.DrawingObjects
Debug.Print "Drawing Object Shapes: "
For Each shp In objDraw.Shapes
PrintShape(shp)
Next shp
Debug.Print ""
Next objDraw
Debug.Print ""
End Sub
PrintParameters(shapeMod.Parameters)
PrintAttributes(shapeMod.Attributes)
PrintBoundary(shapeMod.Boundary)
PrintVertices(shapeMod.Vertices)
End Sub
The following script shows how to use invoke the command to add a shape preprocessor modifier and set the rules on
it:
Sub Main
Dim lay As Layout
Dim lay2 As Layout
Dim shapeMod As ShapeModifier
CreateModifier lay
Debug.Print lay.Name
Debug.Print ""
PrintShapeMod shapeMod
Debug.Print ""
Next shapeMod
Debug.Print ""
' Add the modifier back with add command redo functionality.
lay.InvokeCommand("EditRedo")
Debug.Print ""
End Sub
x1 = -50e-6
y1 = 50e-6
End Sub
Sub PrintShapeMod(ByRef shapeMod As ShapeModifier)
Debug.Print "Name = " & shapeMod.Name
Debug.Print "Enabled = " & shapeMod.Enabled
Debug.Print "MessageId = " & shapeMod.MessageId
Debug.Print "Selected = " & shapeMod.Selected
Debug.Print "Type = " & shapeMod.Type
Debug.Print "Modify Cnt= " & shapeMod.ModifyObjects.Count
PrintParameters(shapeMod.Parameters)
PrintAttributes(shapeMod.Attributes)
PrintBoundary(shapeMod.Boundary)
PrintVertices(shapeMod.Vertices)
End Sub
In the code we include Undo/Redo and verify that the shapes in placed instances are updated to reflect the state of the
modifier.
The API Remove command works with the Array Modifier. The modifier's generated shapes are cleaned up correctly
with the following code:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
modName = "ARRAYMOD.AM10"
Debug.Print lay.Name
Debug.Print "Modifier Count = " & lay.ShapeModifiers.Count
PrintShapeMods lay, "After Remove:"
Debug.Print "Drawing Object Count = " & lay.DrawingObjects.Count & " => Should be 2"
End Sub
The following is the Modifier Library access code that takes into account the registration of a new Shape Modifier in
the Library with the Modifier records:
Debug.Clear
' Test global Access.
For Each modRec In ModifierLibrary
PrintShapeModRecord modRec
Next modRec
End Sub
The following example code shows you how to change Edge Modifier Path points:
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
lay.Update
End Sub
Debug.Print title
Debug.Print lay.Name & "Shape Modifiers"
Debug.Print "Modifier Count = " & lay.ShapeModifiers.Count
For Each shapeMod In lay.ShapeModifiers
PrintShapeMod shapeMod
Debug.Print ""
Next shapeMod
End Sub
PrintParameters(shapeMod.Parameters)
End Sub
This example uses subroutines for printing, as shown in the example code.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
lay.Update
End Sub
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
PrintLayoutModifiers lay
PrintDrawingObjects lay
End Sub
End Sub
PrintParameters(shapeMod.Parameters)
PrintAttributes(shapeMod.Attributes)
PrintBoundary(shapeMod.Boundary)
PrintVertices(shapeMod.Vertices)
End Sub
End Sub
PrintDrawObjParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
End Sub
PrintLayoutModifiers lay
PrintDrawingObjects lay
End Sub
The following example code shows how to highlight Shape Modifiers and print only highlighted Modifier parameters.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
End Sub
Debug.Print title
Debug.Print lay.Name & " Shape Modifiers"
Debug.Print "Modifier Count = " & lay.ShapeModifiers.Count
For Each shapeMod In lay.ShapeModifiers
Debug.Print " Name = " & shapeMod.Name;
Debug.Print title
Debug.Print lay.Name & " Drawing Objects"
index = 1
For Each objDraw In lay.DrawingObjects
If objDraw.TypeBits = 65 Then
Debug.Print " DrawObj[" & index & "]: Marked = " & objDraw.DisplayMode(mwDMT_ObjectMarked)
index = index + 1
End If
Next objDraw
Debug.Print ""
End Sub
Flipping and rotating shapes with associated modifiers where the modifiers are included in the selection
when the command is invoked.
While editing the shape alone might be something the user would do when point selecting objects including the modifiers
in the selection would likely happen when doing area select or select all in a design.
The following code shows how to use InvokeCommands Flip and Rotate when user selecting objects including the
modifiers in the selection with area select or select all in a design:
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditRotate", Array(0, 0, 90.0))
lay.Update
End Sub
Debug.Print title
Debug.Print lay.Name & " Shape Modifiers"
Debug.Print "Modifier Count = " & lay.ShapeModifiers.Count
For Each shapeMod In lay.ShapeModifiers
PrintShapeMod shapeMod
Debug.Print ""
Next shapeMod
End Sub
PrintParameters(shapeMod.Parameters)
PrintPoints(shapeMod)
End Sub
index = 1
For Each vtx In shapeMod.Vertices
Debug.Print "Vertex[" & index & "] = { x = " & vtx.x * 1e6 & ", y = " & vtx.y * 1e6 & " }"
index = index + 1
Next vtx
End Sub
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditFlip", Array(550e-6, 0, 550e-6, 500e-6))
lay.Update
The following script toggles the Layout background color and grid color:
Sub Toggle_Background_Color
Dim o As Option
Debug.Clear
Set o = Application.Options("LayoutBackColor")
o.Value = 16777215 Xor o.Value
Set o = Application.Options("LayoutGridColor")
o.Value = 16777215 Xor o.Value
Exit Sub
End Sub
ang = 0.0
x1 = 100.E-6
y1 = 100.E-6
x2 = 200.E-6
y2 = 100.E-6
xl = 150.E-6
yl = 150.E-6
lay.DrawingObjects(1).Selected = True
lay.DrawingObjects(2).Selected = True
End Sub
In this script, the flip argument itself determines whether or not the move includes a flip. The second argument of the
Move command, flipHorz, can be "True" or "False" depending on whether you want the flip to occur around the horizontal
or vertical axis.
Debug.Clear
Set boun = Project.Schematics(1).Layout.SelectedObjects(1).Boundary
ESnum = Project.Schematics(1).Layout.SelectedObjects.Count
PrintBoun(boun)
Set ob = Project.Schematics(1).Layout.SelectedObjects(1)
PrintObAttr(ob)
Debug.Print ob.BasePosition.x;vbTab;ob.BasePosition.y
PrintObFaces(ob)
PrintObOther(ob)
End Sub
Debug.Print fc.Offset.dy
Debug.Print fc.OffsetAngle
Debug.Print fc.PortNumber
Debug.Print fc.Type
Debug.Print fc.Vertices.Count
Dim vc As Vertex
For Each vc In fc.Vertices
Debug.Print vc.x
Debug.Print vc.y
Next vc
Next fc
End Sub
Sub PrintObOther(ByRef ob As Object)
Debug.Print ob.Flipped
Debug.Print ob.Frozen
Debug.Print ob.InfoText
Debug.Print ob.LayerMapping
Debug.Print ob.ResizeObject
Debug.Print ob.RotationAngle
Debug.Print ob.Selected
Debug.Print ob.TypeBits
End Sub
You need to select the PCell object before running this script.
This output contains the new Window Name. The new Window displays in the workspace.
You can use the CopyToClipboard method to place the Layout in memory and then use the Paste method to paste the
Layout to a different Layout space.
Project.Schematics(1).Layout.CopyToClipboard
If Project.Schematics(2).Layout.CanPaste Then
Project.Schematics(2).Layout.Paste(0,0)
End If
You can use the PrintOut method to send the Layout object to the current printer.
To Access a 3D view and Merge shapes, you can use the following script:
lay.NewWindow(mwLWT_Layout3D).Activate
lay3D.ShapesMerged = True
End Sub
To Access the 3D view visual flags use the following code. This code sets the flags to two different states and then
verifies that the resulting settings match the requested state.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.ThreeDViews.Count = 0) Then
lay.NewWindow(mwLWT_Layout3D)
End If
Debug.Print "Flags = " & flags & ", Visual = " & view3D.Visual
If (view3D.Visual ne flags) Then
Debug.Print "Flags Not Updated Successfully"
Else
Debug.Print "Flags Updated Successfully"
End If
' Set to more complex set of visual attributes and check updated correctly.
flags = mwVV_Shaded Or mwVV_ShapesMerged Or mwVV_Texturing Or mwVV_AntiAliased
view3D.Visual = flags
Debug.Print "Flags = " & flags & ", Visual = " & view3D.Visual
If (view3D.Visual ne flags) Then
Debug.Print "Flags Not Updated Successfully"
Else
Debug.Print "Flags Updated Successfully"
End If
End Sub
The following code sets the correct visual attributes on a 3D view through the Visual Flags property. The commands for
these attributes all toggle the state, so you must first determine the state desired from the flags and then determine if you
need a toggle to match the attribute to that state. A couple were attempting to set the state directly, which resulted in the
state toggling on and off with each subsequent attempt. The following shows an example of using the API to set a number
of View/Visual attributes:
End Sub
You can also set the flags one by one. NI AWR allows you to turn on/off the visual attributes individually without needing
to merge the flags. This may be easier to use when you want to turn on/off a single property. Flags available for use with
the Visual Flags property are as follows:
enum mwViewVisiual {
mwVV_WireFrame = 0x01,
mwVV_Shaded = 0x02,
mwVV_ShowEdges = 0x04,
mwVV_Texturing = 0x08,
mwVV_AntiAliased = 0x10,
mwVV_ExtrudedOnly = 0x20,
mwVV_ShapesMerged = 0x40,
mwVV_ShapesSelected = 0x80,
mwVV_Stippling = 0x100
};
To Access the 3D view ViewFrom property use the following code. The code sets each possible value and checks the
resulting view angles for comparison.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.ThreeDViews.Count = 0) Then
lay.NewWindow(mwLWT_Layout3D)
End If
view3D.ViewFrom = mwVF_Back
PrintView view3D, "Back: "
view3D.ViewFrom = mwVF_Bottom
PrintView view3D, "Bottom:"
view3D.ViewFrom = mwVF_Front
PrintView view3D, "Front: "
view3D.ViewFrom = mwVF_Left
PrintView view3D, "Left: "
view3D.ViewFrom = mwVF_Ortho
PrintView view3D, "Ortho: "
view3D.ViewFrom = mwVF_Right
PrintView view3D, "Right: "
view3D.ViewFrom = mwVF_Top
PrintView view3D, "Top: "
End Sub
To Access the 3D View property, including ShapesMerged property, use the following code:
Sub Main
Dim lay As Layout
Dim view3D As ThreeDView
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.ThreeDViews.Count = 0) Then
lay.NewWindow(mwLWT_Layout3D)
End If
view3D.Shaded = True
PrintVisual view3D, "Shaded: "
view3D.Stippling = True
PrintVisual view3D, "Stippling: "
view3D.Texturing = True
PrintVisual view3D, "Texturing: "
view3D.AntiAliased = True
PrintVisual view3D, "AntiAlias: "
view3D.ShowEdges = True
PrintVisual view3D, "ShowEdges: "
view3D.ShapesMerged = True
PrintVisual view3D, "ShapesMerged:"
view3D.SelectedShapes = True
PrintVisual view3D, "SelectedShps:"
End Sub
Grid Options
Set the Layout ShowGrid property to "True" if you want the Layout Grid to display.
s.Windows(1).Close
End Function
You can use the SnapTogether method to snap together all Layout objects and selected only Layout objects.
schem.Elements("MLIN.TL1").DrawingObjects(1).Selected = True
schem.Elements("TFC.V1").DrawingObjects(1).Selected = True
lay.SnapTogether(mwLST_SelectedOnly)
lay.SnapTogether(mwLST_AllObjects)
The following is one more example of code for SnapTogether all objects:
Now we provide access to the sub-drawing objects of a group object. The ability to traverse elements inside a group
object was added to the API. The important part is that sub-elements should be correctly propagated to the parent object.
We can access to the elements of a group, add a drawing object to a group, remove a drawing object from a group, delete
an object out of a group and access the elements of nested groups. We can now make via api shape selection, shape
move, shape rotate, and shape flip in the group.
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
If (lay.Windows.Count = 0) Then
lay.NewWindow(mwLWT_Layout2D)
End If
lay.Activate
AddShapeToGroup lay
End Sub
End Sub
Debug.Print""
Next grpObj
End If
Debug.Print""
Next objDraw
Debug.Print""
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
End Sub
Debug.Print""
Next grpObj
Debug.Print"*** Group End Depth = " & Depth & " ***"
Debug.Print""
End If
End Sub
We provide support for the drawing object Flatten method for sub-elements of a group. The Flatten method of a drawing
object is called on elements contained inside a group. When the object is flatten it is removed from the group and the
resulting shapes are added back to the group, so the group object is not lost in the process the sub-object is transformed
in place and replaced by its flattened shapes. If the group sub-object is an element associated PCell, the object is flattened
and the Cell is disassociated before being removed from the group and replaced by the flattened shapes.
End If
Next objDraw
End Sub
End Sub
lay.SelectedObjects.AddAll
lay.InvokeCommand("EditorGroup")
When an element that has a buddy is deleted from a group, and the group (or nested groups) is left with a single object,
you should remove the object from the group and insert it back into the diagram ungrouped. This allows you to later
directly delete the object without needing to ungroup it.
lay.Activate
lay.Refresh
For Each drob In lay.DrawingObjects
If drob.TypeBits = 1 Then
drob.Delete
End If
Next drob
End Sub
This skips the Port related Drawing objects and deletes the remaining shape.
To perform a Design Rule Check of the Layout, use the DesignRuleChecker object:
If you do not want to import the rules, you can manually add them directly to the rule set in the script:
The following is another example of sweeping and checking for DRC errors:
Option Explicit
Const PI = 3.14159265358979323846
Sub Main
Debug.Clear
Dim s As Schematic, e As Element
Set s = Project.Schematics("lay2")
Dim drc As DesignRuleChecker, dr As DesignRule, drs As DesignRules
Set drc = s.Layout.DesignRuleChecker
Set drs = drc.CreateRuleSet()
drs.Import(Project.Path & "\notch_drc_check.txt")
SweepAndCheckForErrors(s, drc, drs)
End Sub
Private Function SweepAndCheckForErrors(s As Schematic, drc As DesignRuleChecker, drs As DesignRule
Dim e As Element, p As Parameter
Set e = s.Elements("MCURVE.TL1")
Set p = e.Parameters("ANG")
Dim a As Double, totAngs As Long, errAngs As Long, a10ths As Double
For a = 0 To 90 Step 0.15
MWOffice.Status.RemoveAllItems
p.ValueAsDouble = (PI/180)*a
s.Layout.SnapTogether(mwLST_AllObjects)
drc.RunCheck(drs)
Incr(totAngs)
If(drc.Errors.Count > 0) Then
Incr(errAngs)
Debug.Print "Ang = " & a
End If
Next a
Debug.Print totAngs & " angles checked, " & errAngs & " in error, %" & 100*(errAngs/CDbl(totAngs))
End Function
Private Function Incr (ByRef X As Long) As Long
X = X + 1
Incr = X
End Function
Project.Schematics("Full_Enchilada_Analog").Layout.NewWindow(mwLWT_Layout2D).Activate
Project.Schematics("Full_Enchilada_Analog").Layout.DesignRuleChecker.CompareLayoutToGDSFile(Projec
Debug.Print Project.Schematics("Full_Enchilada_Analog").Layout.DesignRuleChecker.Errors.Count
End Sub
When a Project which previously had the LVS window open is loaded, the LVS window is open but not owned by any
Schematic, so schematic.Layout.LayoutVsSchematicChecker.ErrorsWindow.Visible is always returned as False. To
avoid this, you should close any windows with an Unknown type at the start of the script.
End Function
You can perform a series of operations with Layout.ConnectivityHighlighter object, including highlight all, highlight
off, highlight shape, highlight probe and highlight selected off methods for determining associated shapes in the
connectivity :
Sub Main
Dim lay As Layout
Set lay = Project.Schematics("Schematic 1").Layout
lay.ConnectivityHighlighter.HighlightOff
' lay.ConnectivityHighlighter.HighlightAll
' lay.ConnectivityHighlighter.HighlightShape(lay.DrawingObjects(2), mwCLR_AliceBlue)
Dim x As Double
Dim y As Double
x = lay.DrawingObjects(1).Shapes(1).Vertices(1).x
y = lay.DrawingObjects(1).Shapes(1).Vertices(1).y
lay.ConnectivityHighlighter.HighlightProbe(x, y, mwCLR_Red)
End Sub
You can perform operations with Layout.Connectivity object. After that to access results in Status Window, when the
messages arent errors from MWO, but from lvs check you can use the following code:
cnt = 0
If g_b = True Then
For k = 1 To grp.Items.Count
Debug.Print grp.Items(1).Text
If grp.Items(1).Text = "Found shorted elements" Then cnt = 1
Next k
Else
g_b = True
End If
End Sub
lvs.RunConnectivityCheck
g_b = False
Project.Simulator.Analyze
End Sub
my_mmic.lpf
First Property = 100
Second Property = 200
You have to set UsePeojectOptions to False to set new ProceccDefinition for Schematic:
1
2
index = 1
For Each viaType In layProcDef.ViaTypes
Debug.Print "Via Type[" & index & "] = "
Debug.Print "Name = " & viaType.Name
Debug.Print "Number = " & viaType.Number
Debug.Print "Type Index = " & viaType.TypeIndex
Debug.Print "Valid between = " & viaType.ValidBetween(1, 0)
Debug.Print "Valid Line Type Pairs = "
For Each ltPair In viaType.ValidLineTypeEnds
Debug.Print " " & ltPair.First.Name & " and " & ltPair.Second.Name
Next ltPair
Debug.Print "Valid Line Type Ranges = "
For Each ltPair In viaType.ValidLineTypeRanges
Debug.Print " " & ltPair.First.Name & " and " & ltPair.Second.Name
Next ltPair
Debug.Print ""
index = index + 1
Next viaType
Accessing Process Definition Via Fill Entries and Via Fence Entries
API defines interfaces and objects representing process via fill entries and process via fence entries and collections to
provide access to these values in the LPF for a project. For ViaFill and ViaFence entries API provides methods for adding
a new entry, removing an entry, removing all entries and importing a process definition with via fill entries included.
To access Process Definition Via Fill entry, use the following code:
index = 1
For Each vfe In layProcDef.ViaFillEntries
Debug.Print "Via Fill Entry #" & index
PrintViaFillEntry vfe
index = index + 1
Next vfe
End Sub
End Sub
If layProcDef.Structures.Exists(lt.Name) Then
Debug.Print "Structure " & lt.Name & " Exists in the collection"
Else
Debug.Print "Structure " & lt.Name & " Was not found to exist in the Structures collection"
End If
If layProcDef.Pads.Exists(lt.Name) Then
Debug.Print "Pad " & lt.Name & " Exists in the collection"
Else
Debug.Print "Pad " & lt.Name & " Was not found to exist in the Capacitors collection"
End If
End If
To access the Process Definition Connect Rule, use the following code:
To access the Process Definition Crossover Rule, use the following code:
Sub Main
Dim layProcDef As LayoutProcessDefinition
Dim crossRule As CrossoverRule
' Add one entry to each rule (needs to be unique relative to existing entries.
For Each crossRule In layProcDef.CrossoverRules
crossRule.Entries.Add("Plated Metal Line", "Plated Metal Line", 5e-6)
Next crossRule
End Sub
Debug.Print title
PrintCrossoverRule crossRule
index = index + 1
Next crossRule
Debug.Print "----------------"
Debug.Print ""
End Sub
Sub Main
Dim layProcDef As LayoutProcessDefinition
Dim crossRule As CrossoverRule
Dim index As Integer
End Sub
If layProcDef.Capacitors.Exists(lt.Name) Then
Debug.Print "Structure " & lt.Name & " Exists in the collection"
Else
Debug.Print "Structure " & lt.Name & " Was not found to exist in the Capacitors collection"
End If
End If
These are the layers that were added programmatically. The previous example uses the absolute minimum to add the
layers, and includes optional arguments for line type, fill type and even 3D properties such as z-position.
API allows accessing the default fill patterns and custom fill patterns:
fs = Project.ProcessDefinitions(1).LayerSetup.DrawingLayers("M1").FillStyle
Debug.Print fs
In addition to the LayerSetup, the Process Definition has collections for LineTypes, Structures, Capacitors, Vias, and
Pads. Each of these collections has an Add method that you can use to add values.
This will be very useful when we need to add EM Structure Files to PDKs. To do so we need a way to automatically
update the stackup element dependent LPFs during PDK updates.
API methods are equivalent to the UI methods for updating dependent LPFs in a project. The methods provide the ability
to list the dependent LPF by name, update a particular LPF by giving its name and the options to update. The methods
also provide the ability to update all dependent LPFs and provide the update options.
Below are some examples ways to call the new methods for updating the dependent process definitions:
If (layProc.DependentProcessDefinitionNames.Exists(procName)) Then
layProc.UpdateDependentProcessDefinition procName, True, True, True, True, True
End If
Debug.Print "------------------"
Next layProc
End Sub
The example of the output from running the script can look like the following and you can see 3 dependents for the first
LPF:
To view the Process Definition default Font information, use the following script:
End Sub
When a new Project is created a default Process Definition is added to the Layout as a place holder. To add an EM Layer
Mapping to Process Definition use the following script:
Sub Main
Dim layProcDef As LayoutProcessDefinition
Dim laySetup As LayerSetup
laySetup.EMLayerMappings.Add("MyMapping")
End Sub
index = 1
For Each layMap In laySetup.EMLayerMappings
If laySetup.EMLayerMappings.Exists(layMap.Name) Then
Debug.Print "Layer Mapping " & layMap.Name & " Exists in lookup by name"
Else
Debug.Print "Layer Mapping " & layMap.Name & " Does Not Exist in lookup by name"
End If
Debug.Print ""
index = index + 1
Next layMap
End Sub
End Sub
laySetup.LayerExportMappings.Add("MyMapping", mwLEF_GDSII_Hierarchical)
Using copy methods to the File Export Mappings collection and the EM Layer Mappings collections.
The add methods use to copy a default configuration when invoked but we need explicit copy methods to allow the user
to specify the target that the new file mapping or EM layer mapping should be copied from. The following statements
show copy methods added the layer export file mappings and the em layer mappings collections in the layer setup portion
of the process definition:
The statement will copy the existing "MMIC GDSII" mapping to a new mapping with name "MyMapping".
laySetup.EMLayerMappings.Copy("Default", "MyMapping")
The statement will copy the exiting EM layer mapping "Default" to a new mapping with the name "MyMapping".
When a new Project is created a default Process Definition is added to the Layout as a place holder. When you import
the new Process Definition it overwrites the place holder and becomes the default LPF file. To import a LPF file named
mmic.lpf, use the following script:
The first Import statement imports the mmic.lpf file and replaces the default LPF file in the Project. The second argument
in the last statement, OverwriteDefault, is set to "False" so it does not replace mmic.lpf but is merged into the Project
with it.
After importing the LPF file, the process layers are defined, as well as a number of processing parameters such as the
default length units.
To set the process library on an imported gds library to other than the default use the following script
Script imports a GDS library which associates the library with the default library and then uses the process library property
to associate the library with the second process definition in the project. The properties of the resulting imported cell
library are then being output to verify that the cell library is not associated with default but is associated with the second
process definition.
End Sub
Debug.Print title
Debug.Print "CellLibrary Count = " & Project.CellLibraries.Count
Debug.Print "---"
Next cellLib
Debug.Print ""
End Sub
When you need to run the Connectivity Checker you must add connectivity rules to the LPF file in the Project. To add
rules to the LPF file, run the scripting code as shown in the following example:
lpf.ConnectionRules.RemoveAll()
lpf.ConnectionRules.Add("External_Connect ""Metal 2"" External")
lpf.ConnectionRules.Add("Connect Connect ""Gate Metal"" To ""Metal 1""")
lpf.ConnectionRules.Add("Connect ""Source Drain Metal"" To ""Metal 1""")
lpf.ConnectionRules.Add("Connect ""Ground Via"" To ""Metal 1""")
lpf.ConnectionRules.Add("Connect ""Metal 1"" To ""Metal 2"" By ""Dielectric Via""")
lpf.ConnectionRules.Add("Connect ""Tantalum"" To ""Metal 1""")
lpf.ConnectionRules.Add("Connect ""Mesa"" To ""Metal 1""")
lpf.ConnectionRules.Add("Connect_All ""Ground Via""")
End Sub
For i = 1 To lpf.ConnectionRules.Count
Debug.Print lpf.ConnectionRules(i).Rule
Next i
End Sub
You can use the following script to clean up Connectivity errors in the Project:
Debug.Print lpf.Name
If Left(lpf.Name,1) = "+" Then
lpf.ConnectionRules.RemoveAll()
End If
Next lpf
End Sub
The NI AWR SDE exposes a LayerSetup object from the Project level. This object includes the following collections:
DrawingLayers
DrillTools
LayerMappings
LayerExportMappings
EMLayerMappings
These collections allow modification of the items available in the Layer Setup dialog box of the NI AWR SDE.
The LayerSetup object allows you to access all attributes associated with the DrawingLayers collection:
index = 1
For Each drwLayer In laySetup.DrawingLayers
Debug.Print ""
index = index + 1
Next drwLayer
End Sub
The LayerSetup object allows you to access all methods and properties associated with the DrawingLayers collection.
You can set the color for the Layer object, line color, and line style; and also specify the 3D view object.
21
drawlay.Name = Error
Blend = 0.1 FillColor = 4210943 FillStyle = 21
LineColor = 1000 LineStyle = 0 TextureFile =
TextureScale = 1.3 Thickness = 0.000035 ZPosition = -2.147483648
Error is Filled
Error is Frozen
Error is Opaque
Error is Visible
drawlay.Name = Mesa
Blend = 0 FillColor = 32768 FillStyle = 8
LineColor = 128 LineStyle = 0 TextureFile =
TextureScale = 1 Thickness = 0.0000004 ZPosition = 0
Mesa is Filled
Mesa is Opaque
Mesa is Visible
drawlay.Name = Source Drain
Blend = 0 FillColor = 8421376 FillStyle = 9
LineColor = 8388736 LineStyle = 0 TextureFile =
TextureScale = 0 Thickness = 0.000001 ZPosition = 0.000000001
Source Drain is Filled
Source Drain is Opaque
Source Drain is Visible
drawlay.Name = Source Draintext
Blend = 0 FillColor = 32896 FillStyle = 2
LineColor = 8388608 LineStyle = 0 TextureFile =
TextureScale = 0 Thickness = 0.000002 ZPosition = 0.000001001
Source Draintext is Filled
Source Draintext is Opaque
Source Draintext is Visible
drawlay.Name = Gatepad
Blend = 0 FillColor = 8388608 FillStyle = 9
LineColor = 8388736 LineStyle = 0 TextureFile = 2e6
TextureScale = 0 Thickness = 0.000001 ZPosition = 0.000003001
Gatepad is Filled
Gatepad is Opaque
Gatepad is Visible
drawlay.Name = Gate
Blend = 0 FillColor = 128 FillStyle = 9
LineColor = 8388736 LineStyle = 0 TextureFile = 2e6
TextureScale = 0 Thickness = 0.000002 ZPosition = 0.000004001
Gate is Filled
Gate is Opaque
Gate is Visible
drawlay.Name = Cap Bottom
Blend = 0 FillColor = 32768 FillStyle = 8
LineColor = 8421376 LineStyle = 0 TextureFile = 0
TextureScale = 0 Thickness = 0.000001 ZPosition = 0.000001
Cap Bottom is Filled
Cap Bottom is Opaque
Cap Bottom is Visible
drawlay.Name = Tantalum
Blend = 0 FillColor = 4227327 FillStyle = 9
LineColor = 8388736 LineStyle = 0 TextureFile = 0
As shown in the previous example, the LPF file can have many layers. The NI AWR SDE contains special methods for
the DrawingLayers collection to work only with one layer and make all other layers Not Visible, Filled, or Frozen, as
shown in the following script:
'Code Module
Sub Main
Dim layers As DrawingLayers
Debug.Clear
Set layers = Project.LayerSetup.DrawingLayers
LayerStatus(layers)
layers.AllFilled = False
LayerStatus(layers)
End Sub
Sub LayerStatus(ByRef layers As DrawingLayers)
Debug.Print "Layer Count = " & layers.Count
Debug.Print "All Visible = " & layers.AllVisible
Layer Count = 24
All Visible = True
All Filled = True
All Frozen = False
Layer Count = 24
All Visible = True
All Filled = False
All Frozen = False
Debug.Clear
Set layers = Project.LayerSetup.DrawingLayers
LayerStatus(layers)
layers.AllFilled = False
LayerStatus(layers)
End Sub
The LayerSetup object allows you to access a DrillTool collection. You can add a new DrillTool to a collection and
output all DrillTool properties. You can also remove a DrillTool from the collection.
The following script provides a good example of creating a Drill Hole File. After you select a Drawing Layer and Units
for the Drill Hole File and a Schematic for the Layout, this script creates a set of tools, assigns coordinates for centers,
and creates an output Drill Hole File. Note that the script creates a Snapshot from the beginning.
'Code Module
Dim layerName () As String
Dim layern As String
Dim Dlayer As DrawingLayer
Dim Dl As DrawingLayer
Dim Via As Shape
Dim Snap As Snapshot
Dim lay As Layout
Dim layoutList() As String
Sub Main
Debug.Clear
numlayer = Project.LayerSetup.DrawingLayers.Count
ReDim layerName(numlayer)
j=1
For Each Dlayer In Project.LayerSetup.DrawingLayers
layerName(j) = (Dlayer.Name)
Debug.Print Dlayer.Name
j=j+1
Next Dlayer
'get the drawing layer for drill file
Begin Dialog UserDialog 400,200,"Select Drawing Layer for Drill Hole file" ' %GRID:10,7,1,1
ListBox 40,35,310,100,layerName(),.lstdataBox,1
Text 40,21,160,14,"Select Drawing Layer",.Text1
OKButton 150,160,100,28
End Dialog
Dim dlg1 As UserDialog
Dialog dlg1
Dlayerindexi = dlg1.lstdataBox
Dlayerindexi = Dlayerindexi + 1
Dlayeri = layerName(Dlayerindexi)
Debug.Print Dlayeri
numschematics = Project.Schematics.Count
ReDim layoutList(numschematics)
i=1
For Each s In Project.Schematics
layoutList( i ) = s.Name
i = i+ 1
Next s
'get the layout for the drill file
Begin Dialog UserDialog 400,203, "Select Schematic for layout" ' %GRID:10,7,1,1
ListBox 50,35,300,91,layoutList(),.ListBox1,1 'Select Circuit Schematic
OKButton 80,154,90,21
CancelButton 230,154,90,21
End Dialog
Dim dlg As UserDialog
Dialog dlg
layoutIndex = dlg.ListBox1+1
Set lay = Project.Schematics( layoutIndex ).Layout
Set Snap = lay.CreateSnapshot
Debug.Print "Create Snapshot for layout Name: ";lay.Name
Dim UnitName(2) As String
UnitName(1)="Millimeters"
UnitName(2)="Inches"
'Select the units of the drill file
Begin Dialog UserDialog 400,200,"Select Units for Drill Hole file" ' %GRID:10,7,1,1
ListBox 40,35,310,100,UnitName(),.lstdataBox,1
Text 40,21,160,14,"Select Units",.Text1
OKButton 150,160,100,28
End Dialog
Dim dlg2 As UserDialog
Dialog dlg2
Unitindexi = dlg2.lstdataBox
Unitindexi = Unitindexi + 1
Unitnamei = UnitName(Unitindexi)
Debug.Print "You choose unit: ";Unitnamei
'determine number of shapes on the layer and initialize arrays
numshapes=Snap.Shapes.Count
If k=1 Then
tools(1)=diaunit
numb_tool=numb_tool+1
Else
found=False
For j = 1 To numb_tool
If diaunit = tools(j) Then
found=True
End If
Next j
If found=False Then
numb_tool=numb_tool+1
tools(numb_tool)=diaunit
End If
End If
Debug.Print "centers ";k;" x = ";centersx(k);" y = ";centersy(k)
Debug.Print "diameters ";k;" diameter = ";dia(k)
Next k
'Assign tools to centers
For x = 1 To numshapesL
For y = 1 To numb_tool
If unitnamei="Millimeters" Then
If dia(x)*1e3=tools(y) Then
toolscoor(x)=y
End If
Else
If dia(x)*(1/.0254)=tools(y) Then
toolscoor(x)=y
End If
End If
Next y
Next x
'user can enter filename and directory
fn$ = GetFilePath("Drill file","txt",,"Save Drill file As:",2)
If fn$="" Then Exit Sub 'Cancel was pressed
Open fn$ For Output As #1
'output results to file
Print #1,"M48"
If unitnamei="Millimeters" Then
Print #1,"M71,LZ" 'M71 is metric in mm
Else
Print #1,"M72,LZ" 'M72 is English in inches
End If
For i = 1 To numb_tool
Print #1,"T";Format(i,"00");"C";Format(tools(i),"0.####")
Debug.Print "T";Format(i,"00");"C";Format(tools(i),"0.####")
Next i
Print #1,"%"
For i = 1 To numb_tool
first_shape = True
For j=1 To numshapesL
If toolscoor(j)=i Then
If first_shape Then
first_shape = False
Print #1,"T";Format(i,"00")
Debug.Print "T";Format(i,"00")
End If
Print #1,"X";Format(centersx(j),"000000");"Y";Format(centersy(j),"000000")
Debug.Print "X";Format(centersx(j),"000000");"Y";Format(centersy(j),"000000")
End If
Next j
Next i
Print #1,"T00"
Print #1,"M30"
Close #1
End Sub
M48
M71,LZ
T01C0.64
T02C1.
T03C3.
%
T01
X-006310Y-033145
X-010000Y-038015
X011110Y-033915
X011150Y-028565
T02
X-026900Y-021800
X-025000Y-021800
X-023000Y-021800
X-026900Y-023700
X-025000Y-023700
X-023000Y-023700
X-026900Y-025800
X-025000Y-025800
X-023000Y-025800
T03
X-020200Y-022800
X-021400Y-042200
X000500Y-042800
X001400Y-023200
X017000Y-042800
X015700Y-023600
T00
M30
The LayerSetup object also provides an Export DrawingLayer capability. You only need to set the WriteLayer property
to "True" for the DrawingLayer object you want to export. The following code demonstrates this ability:
Layer Mapping
To map a model layer to the proper drawing layer, use the following code:
Project.LayerSetup.LayerMappings.Add(_Name).Entries.Add(_ModelLayer, _DrawingLayer)
This code adds a new object to a LayerMappings collection. After you add this object, the ModelLayer gets mapped to
the corresponding DrawingLayer.
Project.ProcessDefinitions(1).LayerSetup.LayerMappings(1).Entries(1).DrawingLayer = "Copper"
You can see that the first layer is mapped to "Copper" in the Project.
To access Process Definition Layer Setup Layer Mappings use the following code:
index = 1
For Each layMap In laySetup.LayerMappings
If laySetup.LayerMappings.Exists(layMap.Name) Then
Debug.Print "Layer Mapping " & layMap.Name & " Exists in lookup by name"
Else
Debug.Print "Layer Mapping " & layMap.Name & " Does Not Exist in lookup by name"
End If
Debug.Print ""
index = index + 1
Next layMap
End Sub
End Sub
To access Process Definition Layer Setup File Export Mappings use the following code:
index = 1
For Each layMap In laySetup.EMLayerMappings
If laySetup.EMLayerMappings.Exists(layMap.Name) Then
Debug.Print "Layer Mapping " & layMap.Name & " Exists in lookup by name"
Else
Debug.Print "Layer Mapping " & layMap.Name & " Does Not Exist in lookup by name"
End If
Debug.Print ""
index = index + 1
Next layMap
End Sub
End Sub
To add Process Definition Layer Setup File Export Mappings use the following code:
Debug.Print ""
Debug.Print ""
laySetup.LayerExportMappings.Add("MyMapping", mwLEF_GDSII_Hierarchical)
Debug.Print " ***** After Add LayerExport Mapping *****"
PrintExportMappings(laySetup)
End Sub
index = 1
For Each layMap In laySetup.LayerExportMappings
If laySetup.LayerExportMappings.Exists(layMap.Name) Then
Debug.Print "Layer Mapping " & layMap.Name & " Exists in lookup by name"
Else
Debug.Print "Layer Mapping " & layMap.Name & " Does Not Exist in lookup by name"
End If
Debug.Print ""
index = index + 1
Next layMap
End Sub
When Exporting DXF hierarchical the main problem is that the exportMap parameter (the 2nd parameter) to the
Layout.Export() command is the name of a LayerExportMapping object, which we can get from
Project.ProcessDefinitions().LayerSetup.LayerExportMappings. Heres some of the info you can get from there:
Debug.Print layerExportMaps.Count
Debug.Print layerExportMaps.Item(1).Name
Debug.Print layerExportMaps.Item(1).Type = mwLEF_GDSII_Hierarchical
We can search the LayerExportMappings for a map of type mwLEF_DXF, and then use the .Name of that mapping
when calling Layout.Export():
To access Process Definition Layer Setup EM Layer Mappings use the following code:
index = 1
For Each layMap In laySetup.EMLayerMappings
If laySetup.EMLayerMappings.Exists(layMap.Name) Then
Debug.Print "Layer Mapping " & layMap.Name & " Exists in lookup by name"
Else
Debug.Print "Layer Mapping " & layMap.Name & " Does Not Exist in lookup by name"
End If
Debug.Print ""
index = index + 1
Next layMap
End Sub
To copy Process Definition Layer Setup EM Layer Mappings use the following code:
laySetup.EMLayerMappings.Copy("Default", "MyMapping")
The following is another example of accessing Process Definition Layer Setup Drill Tools:
index = 1
For Each tool In laySetup.DrillTools
Debug.Print "DrillTool[" & index & "] = "
Debug.Print "Name = " & tool.Name
Debug.Print "Number = " & tool.Number
Debug.Print "Radius = " & tool.Radius
Debug.Print ""
index = index + 1
Next tool
End Sub
The NI AWR SDE exposes the Options collection for the Layout Object. The Options collection provides access to a
particular Layout. To apply the Options collection, use the following script:
Sub Main
Dim lay As Layout
Dim opt As Option
Set lay = Project.Schematics(2).Layout
For Each opt In lay.Options
Debug.Print "Name = ";opt.Name;vbTab;"Description = ";opt.Description
Debug.Print "DataType = ";opt.DataType;vbTab;"DefaultValue = ";
opt.DefaultValue;vbTab;"Value = ";opt.Value
Debug.Print
Next opt
End Sub
Name = LayoutGridSpacing Description = Returns/sets the grid spacing for layouts in the projec
DataType = 3 DefaultValue = 25400 Value = 25400
Name = LayoutDatabaseUnits Description = Returns/sets the database units for layouts in the
project.
DataType = 3 DefaultValue = 2540 Value = 2540
Name = LayoutAngleSnapDiv Description = Returns/sets the number of snap divisions per quadrant
layouts in the project.
DataType = 3 DefaultValue = 2 Value = 2
Name = ExportUnionShapes Description = Returns/sets if Layout Shapes should be united on
export.
DataType = 11 DefaultValue = True Value = True
You can configure settings for a particular Layout. To change the default options, set the Use Project options property
to "False".
The following script demonstrates how to set Options/Layout Options/Export/LPF/Artwork Instance export options:
The following API Project level options are the same as the options on the Layout Options dialog box iNet tab. (Choose
Options > Layout Options to view this dialog box.)
LayInetMinViaSize
LayInetViaSizeOpts
LayInetPinRouteOpts
LayInetRouteOpts
LayInetViaInsideRoute
LayInetOverrideForShortSeg
LayInetDefRouteBendStyle
LayInetDefRouteBendAmount
LayRouteViaMode
This script changes the Automatic Via Sizing options and corresponds to the radio button options in the Layout Options
dialog box. The options for the iNet tab are the following:
LayInetMinViaSize = True
LayInetViaSizeOpts = 2
LayInetDefRouteBendStyle = 0
LayInetDefRouteBendAmount = 1
The NI AWR SDE exposes the Layout Mode Options collection. The Mode Options collection provides access to a
particular Layout Mode Property. For example, to access to the layout mode property for drawing origin markers use
the following script:
Debug.Clear
Debug.Print "Active Name = " & MWOffice.LayoutModes.GetActive().Name
Set opts = MWOffice.LayoutModes.GetActive().Options
Debug.Print "Draw Origin Markers = " & opts("DrawOriginMarkers").Value
End Sub
This script toggles the option on and off each time it is run
The NI AWR SDE exposes the CellLibrary collection to enable work with cell libraries. You can create or import Cell
Libraries in GDSII or DXF formats. You can create new cells and draw different Shapes on different Drawing Layers.
The following script demonstrates this ability:
'Code Module
Sub Main
Dim cel As Cell
Dim cels As Cells
Dim sh As Shape
Dim cl As CellLibrary
Dim vr As Vertex
Dim arpath(9) As Double
Debug.Clear
arpath(0) = 0.000006
arpath(1) = 0.000034
arpath(2) = 0.000015
arpath(3) = 0.000034
arpath(4) = 0.000015
arpath(5) = 0.000027
arpath(6) = 0.000022
arpath(7) = 0.000027
arpath(8) = 0.000006
arpath(9) = 0.000034
For Each cel In Project.CellLibraries.Item(1).Cells
Debug.Print cel.Name;cel.Shapes.Item(1).Attributes.Count
Next cel
Set cl = Project.CellLibraries.Add("New Library",mwCLT_GDSII)
For Each cl In Project.CellLibraries
Debug.Print cl.Name
Next cl
Set cl = Project.CellLibraries(1)
Debug.Print cl.Name
Set cel = cl.Cells.Add("New Cell")
Debug.Print cel.Name
Set sh = cel.Shapes.AddRectangle(0, 0, 10e-6, 10e-6, "Cap Bottom")
Set sh = cel.Shapes.AddPolygon(arpath(),"Cap Bottom")
Set sh = cel.Shapes.AddPath(arpath(),10e-6,"Cap Bottom")
Set sh = cel.Shapes.AddEllipse(2*10e-5,10e-5,0.5*10e-5,0.8*10e-5,"Cap Bottom")
Set sh = cel.Shapes.AddPort(0.000006,0.000015,0.000015,0.000015,1)
Set sh = cel.Shapes.AddText(0.000018,0.00001,10e-6,"New Cell","Cap Bottom")
Set sh = cel.Shapes.AddDrillHole(0.5*10e-6,0.5*10e-6,"Drill 1")
Set sh = cel.Shapes.AddArc(0, 0, 100e-6, 180.0, 90.0, "Source Drain")
Debug.Print "Shapes.Count = ";cel.Shapes.Count
For Each sh In cel.Shapes
Debug.Print sh.Type;vbTab;sh.DrawingLayer.Name
Next sh
End Sub
This script creates a "New Library" subnode under the Cell Libraries node and a Cell "New Cell" subnode under the "New
Library" subnode. The Cell "New Cell" contains all permitted types of Shapes in the NI AWR SDE.
You can create a cell in one line of code as shown in the following example:
Project.CellLibraries.Add("TempLibrary",mwCLT_GDSII).Cells.Add("TestCell").Shaps
.AddRectangle(0, 0, 10e-6, 10e-6, "Cap Bottom")
You can create a cell from a hierarchical layout, which includes just the selected objects as shown in the following
example:
Sub Main
Dim lay As Layout
Dim ret As Variant
Dim dl As DrawingLayer
Dim objDraw As DrawingObject
Debug.Clear
Set lay = Project.Schematics("SCH1").Layout
' Create cell and flatten objects, select only one of the two.
lay.SelectedObjects.RemoveAll
lay.DrawingObjects(1).Selected = True
lay.CreateCell("New_Gdsii_Lib", "NewCell", mwOIT_SelectedObjects, True)
End Sub
Debug.Print title
Debug.Print "DrawingObjects Count = " & lay.DrawingObjects.Count
For Each objDraw In lay.DrawingObjects
PrintDrawingObject objDraw
Debug.Print ""
Next objDraw
Debug.Print ""
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
Debug.Print "Parameters:"
For Each param In params
Debug.Print param.Name & " = " & param.ValueAsString
Next param
End Sub
You can create a cell from a hierarchical layout, which includes all objects if you use the following:
To iterate through the collection of Libraries and Cells and access cell information, use the following code:
Dim c As Cell
Dim l As CellLibrary
Dim info As CellInfo
For Each l In Project.CellLibraries
For Each c In l.Cells
Debug.Print c.Name
Set info = c.Info
Debug.Print "Info Face Count = " & info.FaceCount
With access to the Cell you get access to the Shapes collection. You can also access the Shapes.Vertices collections and
you can add Vertex to the collection.
Note that the Layout Cell you created returns "True" for the Modified property.
You should check this property before trying to Add Shapes to the Cell. If this property returns to "False" you cannot
Add Shapes to the Cell.
If Add Shape to the Cell fails, check the x and y properties for reasonable values. This may help you determine the cause
of the failure.
A CellInstances collection of the Cell object allows you to access the Cell Instances (sub cells) of a cell. From the Cell
Instance object you can determine the master Cell and master Library names, which allow you to then get the master of
that Cell and traverse it for Cell Instances. The collection also allows you to add a Cell Instance (create a new Instance
in the cell) to the Cell Instances collection.
When you add a new artwork cell or library an error message displays if you try to name it with an existing cell or library
name.
You get and set Shape and Cell LineType settings through the DrawingObject.Attributes collection because Drawing
objects can be a range of objects including artwork cells, subcircuit Layouts, or dumb Shapes.
You can index the LineType attribute by name, and you can use Attributes.Exists("LineType") to verify whether an
object has the attribute before trying to get or set it.
To display all attributes for all of the drawing objects in a Layout, use the following code:
' Get and output the attributes for all the drawing objects in the layout of each Schematic.
Sub Main
Dim schem As Schematic
Dim lay As Layout
Dim objDraw As DrawingObject
Dim attr As Attribute
Dim index As Integer
Dim attrIndex As Integer
Debug.Clear
Set schem = Project.Schematics("Schematic 1")
Set lay = schem.Layout
index = 1
The following script tests for the existence of and sets the line type attribute on a Drawing object, and then checks the
new value:
' Demonstrates setting the line type attribute for drawing objects in a layout.
Sub Main
Dim schem As Schematic
Dim lay As Layout
Dim objDraw As DrawingObject
Debug.Clear
Set schem = Project.Schematics("Schematic 1")
Debug.Print "Schematic = " & schem.Name
Set lay = schem.Layout
For Each objDraw In lay.DrawingObjects
If (objDraw.Attributes.Exists("LineType")) Then
Debug.Print "Old Line Type = " & objDraw.Attributes("LineType").ValueAsString
' Set the line type to new value here.
objDraw.Attributes("LineType").Value = 1
Debug.Print "New Line Type = " & objDraw.Attributes("LineType").ValueAsString
End If
Next objDraw
End Sub
Schematic = Schematic 1
Old Line Type = 0
New Line Type = 1
A special AddFaceEx method for the Shapes collection allows you to specify the Layer name when adding Faces through
the collection.
The AddFaceEx method includes an optional argument for the Model layer. With this method you can add a cell port as
in the following code:
End Sub
Accessing model layer to drawing layer mapping when adding cell Path
API allows layer name to be specified by model layer, drawing layer or model layer to drawing layer mapping strings.
This can be applied for adding arc, pin, ellipse, path, polygon, rectangle and text objects. With drawing layer mapping
method you can add a path as in the following code:
pts(0) = 0
pts(1) = 0
pts(2) = 100e-6
pts(3) = 0
pts(4) = 100e-6
pts(5) = 100e-6
pts(6) = 200e-6
pts(7) = 100e-6
The following code shows how how to change Model layer for Cell:
Option Explicit
Sub Main
Debug.Clear
Dim c As Cell, ce As CellEditor
Dim i As Long, layCount As Long, dwgLays As LayerMapEntries
Debug.Print layCount
For i = 1 To layCount
Debug.Print
Set c = Project.CellLibraries(1).Cells(1)
Set ce = c.EditCell
Dim d As DrawingObject
Set d = ce.DrawingObjects(1)
d.Attributes("LayerIndex") = 25
Debug.Print "new layer = " & d.Shapes(1).DrawingLayer.Name
ce.SaveCell
ce.Windows(1).Close
End Sub
To use the CellEditor to Add a Drawing object to a Selection, use the following script:
To use the Cell Editor to Copy to the Clipboard, use the following script:
Debug.Print "Done"
End Sub
To use the Cell Editor to Create a Rectangle, use the following script:
With the Editor object you can open an Artwork Cell for editing and then perform editing commands similar to those in
a Schematic Layout. The following method saves Cell edits and prevents a Cell edit query from displaying when saving
the project. The code should run without dialog boxes:
To use the Cell Editor for Design Rule Checking, use the following script:
Sub Main
Dim libCell As Cell
Dim editor As CellEditor
Debug.Clear
Set libCell = Project.CellLibraries("TDMSDEMOLIB.DB").Cells("CCADC")
Set editor = libCell.EditCell
Debug.Print "Cell = " & libCell.Name
Debug.Print "Exporting editor content...";
editor.Export("c:\my_cell.gds", 1)
Debug.Print "Done"
End Sub
To use the Cell Editor to create a new Window, use the following script:
To use the Cell Editor to Print Out, use the following script:
To use the Cell Editor to Create a new Cell by editing a Cell, use the following script:
To use the Cell Editor to Edit a Cell, use the following script:
To use the Cell Editor to Save Cell edits and prevent a query regarding the edits from displaying when saving the Project,
use the following script:
The following script performs filtering on the shape type (path), copy and paste into a DXF design using CellEditor:
Debug.Clear
lay.InvokeCommand("EditCopy")
cellEd.Paste(0,0)
cellEd.SaveCell
libCell.Windows(1).Close
To Loop through drawing cell objects during EditCell use the following script:
Debug.Clear
ed.SaveCell
Debug.Print ed.DrawingObjects(1).InfoText
End Sub
To use the Cell Editor to access Editor properties, use the following script:
To use the Cell Editor to access Base, use the following script:
You can use Invoke command to draw a cell port object in a layout cell editor window, as shown in the following example:
Sub Main
Dim lay As Layout
Dim ret As Variant
Dim objDraw As DrawingObject
Dim libCell As Cell
Dim ed As CellEditor
ed.SaveCell
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
End Sub
End Sub
To determine the contents of a Cell Library you need a script that searches through the Libraries, and for each Library
goes through the Cells, and for each Cell goes through the Instances and Shapes for that Cell. For Instances, you need
to print the name of the master Cell and the Library in which that master Cell resides. (An Instance points backward to
indicate what Cell to draw in the current Cell.) Instances allow you to re-use a Cell by placing several Instances of that
cell in another Cell. The first Cell becomes a building block that is re-used in the second Cell through Instances. The
following script uses indenting to show the structure. Cell Libraries are at the top; in them are a collection of Cells, and
inside the Cells are Instances and Shapes. The Instances refer back to other Cells in the same or different Library, so to
determine which Cell the Instance refers to you need to know both the master Cell and master Library name. This script
prints the master Cell name and the master Library name as the From Library:
Debug.Clear
' For Each Instance in the cell print the master cell name and library
Debug.Print " Instances: "
For Each inst In libCell.Instances
Debug.Print " Inst Master Cell: " & inst.MasterCell & ", From Library: " & inst.MasterLibr
Next inst
' For Each Shape in the cell print the drawing layer for that shape
Debug.Print " Shapes: "
For Each shp In libCell.Shapes
Debug.Print " Drawing Layer: " & shp.DrawingLayer.Name
Next shp
Debug.Print
Next libCell
Debug.Print
Next cellLib
End Sub
Cell: sub2
Instances:
Shapes:
Drawing Layer: NiCr
Drawing Layer: Copper
Cell: Top
Instances:
Inst Master Cell: sub2, From Library: Old
Inst Master Cell: sub1, From Library: Old
Shapes:
Drawing Layer: NiCr
Drawing Layer: Copper
Drawing Layer: NiCr
Drawing Layer: Copper
Cell: Top
Instances:
Inst Master Cell: sub2, From Library: New
Inst Master Cell: sub1, From Library: New
Shapes:
Drawing Layer: NiCr
Drawing Layer: Copper
Drawing Layer: NiCr
Drawing Layer: Copper
Cell: sub2
Instances:
Shapes:
Drawing Layer: NiCr
Drawing Layer: Copper
Cell: sub1
Instances:
Shapes:
Drawing Layer: NiCr
Drawing Layer: Copper
Notice that sub1 and sub2 do not have any Instances, just Shapes. For the sub1 and sub2 Instances in the "Top" cell there
is both a master Cell name and Library printed.
The following code adds Cell Instancies to the source Cell Library:
libCell.Instances.Add("TDMSDEMOLIB.DB", "AND2", 0, 0)
libCell.Instances.Add("TDMSDEMOLIB.DB", "BJT2CMOS", -100e-6, 0)
libCell.Instances.Add("TDMSDEMOLIB.DB", "CMOS2BJT", 100e-6, 0)
PrintCellInfo(libCell)
PrintCellInstanceInfo(libCell)
End Sub
Next cellInst
End Sub
The following code creates a library and cells and using the instances methods to add references to other cells within the
library. A library hierarchy is created with the library structure:
PrintCellInfo(libCell)
PrintCellInstanceInfo(libCell)
Debug.Print "*************"
PrintCellInfo(libCell)
PrintCellInstanceInfo(libCell)
End Sub
Sub PrintCellInfo(ByRef libCell As Cell)
Dim info As CellInfo
Next cellInst
End Sub
This is typically the way many designs are created with one library as a reference and one as the actual design. The
following code prints the instance reference names and they should correctly reflect both the library name and cell name
since the cells are from a different library:
PrintCellInfo(libCell)
PrintCellInstanceInfo(libCell)
End Sub
Next cellInst
End Sub
1. No change (the Cell is copied without hierarchy) - this option depends on lookup to locate any Instances.
2. Flatten (all Instances in the Cell are flattened) - all Shapes are self-contained in the Cell. Flatten = "False" copies the
cell without hierarchy. Flatten = "True" flattens all the Instances to flat Shapes and copies the result.
3. (Cells.Copy2) - copies the hierarchy (the argument copyChildren) and should allow you to perform the copy with
hierarchy.
Note that if in the Project the top3 Cell has an Instance that is a reference to cellA from Lib1 of the same Project, Lib3
does not have it's own cellA; it refers to cellA of Lib1. Since Lib3 does not have a Cell named cellA, you will not see it
if you print Cell names from the Lib3 Library. Choose Options > Environment Options to display the Environment Options
dialog box, then click the Layout tab and clear the Show top level library cells only option to display the Cell libraries flat
in the Project Browser. You can see that Lib1 and Lib2 have a cellA Cell in the Library but Lib3 does not. The following
command copies Lib3 top3 to Lib1 and correctly retains the reference to cellA from Lib1:
The following command copies Lib3 top3 to Lib2 and creates a new Cell cellA_copy so it is not referencing cellA from
Lib2:
By default, only the top level Cells (not the Cells in the Library) display. If you clear the Show top level library cells only
option then you can see a flat listing of all the Cells in each Library. So, Lib3 really only has one Cell (top3) and does
not contain a cellA. The Copy2 command, however, is functioning correctly in terms of copying the top3 Cell with
hierarchy.
The CellLibrary has a method in the API named Merge which allows you to perform merges between libraries. A Merge
command associated with a Cell Library allows you to Merge other libraries with that Library. This command is the
equivalent of right-clicking a Library in the Layout Manager and choosing Merge Cell Libraries. The following script
merges Lib2 into Lib1 and sets Print to "True":
End Sub
The following code imports the "First.gds" CellLibrary into the Project and creates a "First" subnode under the Cell
Libraries node in the Layout Manager.
Project.CellLibraries.Import("First","First.gds",mwCLT_GDSII)
Note that CellLibrary must be in the Project directory or you must include the path to the code. Also, when directly
importing DXF files to CellLibraries, be aware that some DXF files have units defined in the files and some do not. To
define the unit scale when importing a DXF file, use the following code:
Project.CellLibraries.Import2(Name,FileName,mwCLT_DXF, scale)
If the units are defined in the file, this scale has no affect.
Dim cl As CellLibrary
Dim dxfcell As Cell
Dim meter_per_inch As Double
pth = Project.Path
fn = pth+"filtronic_dxf.dxf"
meter_per_inch = 0.0254
Set cl = Project.CellLibraries.Import2("filtronic",fn,mwCLT_DXF, 1e-3)
'below adds to a schematic layout,
'Project.Schematics(1).Layout.DrawingObjects.AddCell("test","test",0,0)
If the units are defined in the file you can use the following function:
Project.CellLibraries.Import(Name,FileName,mwCLT_DXF)
The following script opens a Cell in the Cell Editor and then uses the Cell Editor Export method to perform the export.
"DXF" is the name of a file mapping in the Project. This is the name of the default DXF file mapping created when the
Project was created. You can create another file mapping if you want to change how the exported layers are mapped. In
the Layout Manager, select the Layer Setup node, then right-click and choose Edit Drawing Layers. In the Drawing Layers
Options dialog box, select the File Export Mappings node (GDSII, Gerber, and DXF) and choose, for example New GDSII
Export Mapping to create a custom mapping. To export the Project you must turn on (click the Check All button) all layers
in the export map.
The Export method determines what type of export to perform based on the type of file mapping you give it. For example,
if it is a GDSII file mapping it exports GDSII, or if it is a DXF file mapping it exports DXF.
' Note: Here "DXF" is the name of a DXF type file mapping in the layer setup
' The name can be the name of any DXF type file mapping in the layer setup.
cellEd.Export("new_trf_flat.dxf", "DXF", True)
cellEd.Export("new_trf_hier.dxf", "DXF", False)
' Import the libraries back into the library browser
Project.CellLibraries.Import2("new_trf_flat", "new_trf_flat.dxf", mwCLT_DXF)
Project.CellLibraries.Import2("new_trf_hier", "new_trf_hier.dxf", mwCLT_DXF)
End Sub
Next script shows text exporting and importing in DXF format. The script exports a design with poly text and view text
and then re-import the exported file.
delete_if_exists(libPath)
libCell.Shapes.AddText(100e-6, 100e-6, 30e-6, "Text", "Source Drain", 0, "", False, False, False)
cellLib.SaveAs(libPath)
Project.CellLibraries.Remove(cellLib.Name)
Project.CellLibraries.Import("Cell_Lib", libPath, mwCLT_DXF)
End Sub
PrintParameters(drawingObj.Parameters)
PrintAttributes(drawingObj.Attributes)
PrintBoundary(drawingObj.Boundary)
PrintEditHandles(drawingObj.EditHandles)
PrintVertices(drawingObj.Shapes(1).Vertices)
End Sub
End Sub
UsesProcessLayers = 0
LayerMapping = 0
LayerIndex = 3
PositionFixed = 0
FlipState = 0
RotationAngle = 0
Area = 0.000000000119646
IsEMExtract = 0
GroupName =
LayerName = Source Drain
Boundary:
Left = 0.00010063
Right = 0.00011593
Top = 0.00013
Bottom = 0.00010048
Edit Handles:
{ x= 0.00010954, y= 0.00010048 }
{ x= 0.00010954, y= 0.0001135 }
{ x= 0.00010954, y= 0.00012652 }
{ x= 0.000112735, y= 0.00012652 }
{ x= 0.00011593, y= 0.00012652 }
{ x= 0.00011593, y= 0.00012826 }
{ x= 0.00011593, y= 0.00013 }
{ x= 0.00010828, y= 0.00013 }
{ x= 0.00010063, y= 0.00013 }
{ x= 0.00010063, y= 0.00012826 }
{ x= 0.00010063, y= 0.00012652 }
{ x= 0.00010381, y= 0.00012652 }
{ x= 0.00010699, y= 0.00012652 }
{ x= 0.00010699, y= 0.0001135 }
{ x= 0.00010699, y= 0.00010048 }
{ x= 0.000108265, y= 0.00010048 }
Vertices:
{ x= 0.00010954, y= 0.00010048 }
{ x= 0.00010954, y= 0.00012652 }
{ x= 0.00011593, y= 0.00012652 }
{ x= 0.00011593, y= 0.00013 }
{ x= 0.00010063, y= 0.00013 }
{ x= 0.00010063, y= 0.00012652 }
{ x= 0.00010699, y= 0.00012652 }
{ x= 0.00010699, y= 0.00010048 }
Use an Export method as in the following code to the Cell object in the API so that a single cell can be exported directly
in a manner similar to right clicking on the cell in the UI and selecting "Export Layout Cell" from the context menu:
Debug.Clear
Set libCell = Project.CellLibraries("TDMSDEMOLIB.DB").Cells("AND2")
Debug.Print libCell.Name
This will export the cell in GDSII format flat. The cell could be exported in DXF format with mwCEF_DXF.
Dim cl As CellLibrary
Debug.Clear
For Each cl In Project.CellLibraries
Debug.Print "Library name = "; cl.Name;vbTab;"ExcludeFromExport = ";cl.ExcludeFromExport
Debug.Print "Filename = ";cl.Filename;vbTab;"Modified = ";cl.Modified;vbTab;"SearchPriority = "
;cl.SearchPriority
Debug.Print "ReadNewest = ";cl.ReadNewest;vbTab;"ReplaceAllCells = ";cl.ReplaceAllCells;vbTab;"T
;vbTab;cl.Type
Debug.Print
Next cl
To output or set the name of the Process Definition to use with a specified Cell Library, use the following code:
Dim cl As CellLibrary
Set cl = Project.CellLibraries(1)
Debug.Print cl.ProcessDefinition
Default
The Process Definition to be used with the Cell Library is named "Default".
To Save a Cell Library under the new file name, use the following code:
Dim cl As CellLibrary
Set cl = Project.CellLibraries.Item(1)
Debug.Print cl.Name
cl.SaveAs(cl.Name &".gds")
To add all cells from the library, use the following code:
Dim l As CellLibrary
Set l = Project.CellLibraries("PSCTESTLAY1.DB")
Dim c As Cell
Dim s As Schematic
Set s = Project.Schematics("NMOS_RF_Cds_cells")
For Each c In l.Cells
s.Layout.DrawingObjects.AddCell(l.Name, c.Name, 0, 0)
Next c
Updating layout view after creating artwork cell and placing it in schematic layout
After adding all cells from the library, use the following code to update the layout view:
Dim l As CellLibrary
Dim c As Cell
End Sub
Layout.Refresh command also works, but we need to be sure that layout window is open, so, we need to use the following
code:
If (sch.Layout.Windows.Count = 0) Then
sch.Layout.NewWindow(mwLWT_Layout2D)
End If
sch.Layout.Refresh
The following fragment of code exports the layout as a GDS file, then re-imports the exported result as a cell library and
then opens a cell editor on the library schematic cell to allow the objects of the cell to be enumerated:
Project.Schematics("SCH1").Layout.Export(libPath, 1)
Project.CellLibraries.Import("Cell_Lib", libPath, mwCLT_GDS)
Set libCell = Project.CellLibraries("Cell_Lib").Cells("SCH1")
Set cellEd = libCell.EditCell
The following fragment of code exporting layout shapes to dxf and then re-importing them as cell libraries:
Project.Schematics("SCH1").Layout.Export(libPath, 1)
Project.CellLibraries.Import("Cell_Lib", libPath, mwCLT_GDS)
Set libCell = Project.CellLibraries("Cell_Lib").Cells("SCH1")
Set cellEd = libCell.EditCell
Navigating Layout
Negative Layers
The NI AWR SDE Layout supports the concept of negative layers. The following layer types are supported:
Positive Layers
Negative Layers
Normal Layers
To find all types of Layers via the NI AWR SDE, use the following code.
The GlobalEquations collection creates equations in the Global Definition window (Global Definitions node in the
Project Browser).
The OutputEquation collection creates equations in the OutputEquation window (Output Equations node in the Project
Browser).
The Schematics collection allows you to create equations inside the Schematic window.
The SystemDiagram collection allows you to create equations inside the SystemDiagram window.
The GlobalEquations collection of objects allows you to define global variables and equations for use anywhere within
the Project.
mils_per_meter=39370
valstr(0) = mils_per_meter=39370
l=460/mils_per_meter
valstr(1) = l=460/mils_per_meter
C_light=2.997925e+8
valstr(2) = C_light=2.997925e+8
pi=3.1415926
valstr(3) = pi=3.1415926
iCount = 4
mils_per_meter=39370
l=460/mils_per_meter
C_light=2.997925e+8
pi=3.1415926
iCount = 4
iCount = 5
To access the Global Equation Expression by variable name, use the following script:
Debug.Clear
Set globalDoc = Project.GlobalDefinitionDocuments("Global Definitions")
For Each eqn In globalDoc.Equations
For Each expr In eqn.Expressions
varName = Left(expr.Expression, InStr(1, expr.Expression, "=") - 1)
If eqn.Expressions.Exists(varName) Then
Debug.Print "Found expression " & expr.Expression & " by varName: " & varName
Else
Debug.Print "Could not find " & expr.Expression & " by varName: " & varName
End If
Next expr
Next eqn
To add a Global Equation with InsertEquation command on a GlobalDocument , use the following script:
The following script deletes all Global Def equations, then adds a new equation "2 + 3:", and then runs
ge.InvokeCommand("SimulateUpdateEquations", args, retval). You can run Project.Simulator.Analyze and it will update,
but to update without simulating use the following InvokeCommand():
Debug.Clear
Dim ge As GlobalDefinitionDocument
Dim args, retval
Set ge = Project.GlobalDefinitionDocuments(1)
If ge.Windows.Count = 0 Then
ge.NewWindow()
End If
Dim i As Long
For i = ge.Equations.Count To 1 Step -1
ge.Equations.Remove(i)
Next i
ge.Equations.Add2("2 + 3:", 0, 0)
Debug.Print retval
We converted the Update equations command from a view UI macro which called into the document to a command
object which calls into the document. The advantage of command is that it doesn't require access to a view object in
order to be invoked so the API can invoke the command as well. This allows the API to use a command such as:
Where ge can be a Schematic, System Diagram, Global Definitions etc. We also added an Update() api method to the
Equations collection which can also be used to update the equations in a more direct API call. With this the equations
can be updated using a call such as:
ge.Equations.Update
Where again ge can be a Schematic, System Diagram, Global Definitions Document etc.
You can apply the Selected property to an Equation object. This allows you to set equations to selected or unselected as
well as determine which equation objects are selected.
To set relations between Element parameters and the GlobalEquation.expression, use the following script:
Sub Main
Debug.Clear
Dim eqn As Equation
For Each eqn In Project.GlobalEquations
Debug.Print eqn.Expression
Next eqn
Dim schem As Schematic
Dim ele As Element
Set schem = Project.Schematics.Add("Master")
Set eqn = schem.Equations.Add("X=99",0,100)
eqn.Tune = True
Set ele = schem.Elements.Add("Res",0,0,0)
Dim p As parameter
Set p = ele.parameters("R")
p.ValueAsString = "X"
Set ele = schem.Elements.Add("PORT",0,0,0)
Set ele = schem.Elements.Add("PORT",1000,0,180)
End Sub
To Add an Element (in this case an MSUB), use the following code:
Project.GlobalDataElements.Add("MSUB", 0, 0)
Project.GlobalDataElements.Remove("MSUB.SUB1")
Project.GlobalDataElements.RemoveAll
To list Elements in the Multiple Global Definitions, use the following script:
Debug.Clear
Having access to multiple Global Definition Documents enables adding and removing documents programmatically
from this collection.
docName = "MyGlobalDefDoc"
If Project.GlobalDefinitionDocuments.Exists(docName) Then
Debug.Print "Document " & docName & " found to exist in the collection"
Else
Debug.Print "Document " & docName & " not-found to exist in the collection"
End If
To add an Element to each Global Definitions Document, use the following code:
End Sub
If doc.DataElements.Exists(elem.Name) Then
Debug.Print "Element named " & elem.Name & " exists in the data elements collection."
Else
Debug.Print "Element named " & elem.Name & " not-found in the data elements collection."
End If
End Sub
Project.GlobalDefinitionDocuments.Remove(docName)
To define a Variable or Equation for a particular Schematic or SystemDiagram, use the following code.
After running this code, two equations display in the "Filter" Schematic. The two arguments after the text string in the
Add method are the X and Y position that determine where the equation is placed. Note that the X-axis is oriented
left-to-right and the Y-axis is oriented top-to-bottom.
You can also set equations for optimization using Constrain, Distribution, LowerConstraint, UpperConstraint, Optimize,
OptimizeYield, StatVariation, TolInPercent, and UseStatistics properties.
Dim s As Schematic
Dim e As Equation
Set s = Project.Schematics("Diode Mixer")
Set e = s.Equation("GroundReturn") 'the Equation object
Set e.X = -1000
Set e.Y = -4000
e.Tune = True 'Make tunable
e.Optimize = True
e.Constrain = True 'To constrain
eLower.Constraint = 0.5
e.UpperConstraint = 3.0
The Expression property of the equation returns the entire expression, not just a value of the expression. For the previous
example the returned expression is:
"GroundReturn" = 1.25
You can use this property to set or get the equation. You should use the update method on the equation and expression
objects. Those methods cause schematic equations to be evaluated and display their results. You can use DisplayText
property for equations and expressions which allows access to the evaluation results text of an equation and equation
expression:
Sub Main
Dim schem As Schematic
Debug.Clear
Set schem = Project.Schematics("SCH1")
PrintSchemEqnExprs schem, "*** Before Update Equations ***"
schem.Equations.Update
Debug.Print title
For Each eqn In schem.Equations
For Each expr In eqn.Expressions
PrintExpr expr
Next expr
Next eqn
Debug.Print ""
End Sub
Debug.Print ""
End Sub
API also has "SimulateUpdateEquations" InvokeCommand() method to update and simulate the equation.
To disable the equation in the Schematic or SystemDiagram, set the Enable property to "False".
To access either the left side (name) of the equal sign or the right side (value) of the equal sign, use the following functions:
The NI AWRDE handles the entire equation as a string through the "Expression" method (for example,
Equation.Expression), as shown in the following code:
Since the program handles the entire group of equations as a string through the "Expression" method, each equation in
the group is separated from the next equation by a carriage return and line feed characters.
Dim x as String
x = Project.Schematics(1).Equations(1).Expression
project.Schematics(1).Equations(1).Expression = "x=11"+vbCRLF+"y=21"+vbCRLF+"z=31",
or:
project.Schematics(1).Equations(1).Expression = "x=11"+chr(13)+chr(10)+"y=21"
+chr(13)+chr(10)+"z=31"
Debug.Print Project.Schematics(1).Equations.Count
There are equation properties for individual equations within the group. To change an equation property you must first
specify which equation you want to work on, and then change the desired property. (In the following code, the second
equation in the group is disabled). To specify which equation in the group to access, use the ActiveIndex property on
the Equation object:
project.Schematics(1).Equations(1).ActiveIndex=2
project.Schematics(1).Equations(1).Enabled=False
When you access the Enabled or Tune properties, they function in the group on the equation that ActiveIndex selects.
By default, ActiveIndex is set to "one".
If equations are organized as separate equations (without grouping them), they are treated as the usual collection of
equations.
Output Equations assigns the result of a Measurement to a variable, which you can use in other equations just like other
variables.
Note that in OutputEquations the values must be specified in MKS units; conversion to the Project units does not work.
You must provide explicit units conversions in OutputEquations.
Sub Main
Debug.Clear
Dim eqn As Equation
Dim valstr(11) As String
Dim freq As Frequency
Dim gs As Graphs
Dim g As Graph
Dim schem_Name As String
Dim m As Measurement
Dim mm As Measurement
Dim valze() As Double
Dim valzo() As Double
'Define the Name of the Schematic
schem_Name = Project.Schematics(1).Name
Debug.Print schem_Name
valstr(0) ="y11="&schem_Name &":Y(1,1)"
Debug.Print valstr(0)
valstr(1) ="y12="&schem_Name &":Y(2,1)"
valstr(2) ="y13="&schem_Name &":Y(3,1)"
valstr(3) ="y14="&schem_Name &":Y(4,1)"
valstr(4) = "a=0.5*(y11+y12)"
valstr(5) = "b=0.5*(y11-y12)"
valstr(6) = "c=-0.5*(y13+y14)"
valstr(7) = "d=-0.5*(y13-y14)"
valstr(8) = "ye=2*sqrt(a*a-c*c)"
valstr(9) = "yo=2*sqrt(b*b-d*d)"
valstr(10) = "ze=1/ye"
valstr(11) = "zo=1/yo"
' Adding Equations
For i = 0 To 11
Set eqn = Project.OutputEquations.Add(valstr(i),0,i*100)
Debug.Print Project.OutputEquations.Item(i+1)
Next i
Set gs = Project.Graphs
Set g = gs.Add("Ze and Zo",mwGT_Rectangular)
g.Measurements.Add("ze","Re(Eqn)")
g.Measurements.Add("zo","Re(Eqn)")
Project.Simulator.Analize
Set m = Project.Graphs("Ze and Zo").Measurements("ze:Re(Eqn)")
Set mm = Project.Graphs("Ze and Zo").Measurements("zo:Re(Eqn)")
cPoints = m.XPointCount
ReDim Preserve valze(cPoints)
ReDim Preserve valzo(cPoints)
'Debug.Print cPoints
For i=1 To cPoints
valze(i) = m.YValue(i,1)
valzo(i) = mm.YValue(i,1)
'Debug.Print i;";m.XValue(i)/1.e9;vbTab;m.YValue(i,1);vbTab;mm.YValue(i,1);
vbTab;valze(i);vbTab;valzo(i)
Next i
End Sub
You need to create Graphs and Measurements before using the results of the Measurements. The Measurement results
are assigned to arrays valze(cPoints) and valzo(cPoints). The length of these arrays depends on the amount of points in
the Measurements.
Model Lange
y11=Schematic 1:Y(1,1)
y11 = Schematic 1:Y(1,1)
y12 = Schematic 1:Y(2,1)
y13 = Schematic 1:Y(3,1)
y14 = Schematic 1:Y(4,1)
a=0.5*(y11+y12)
b=0.5*(y11-y12)
c=-0.5*(y13+y14)
d=-0.5*(y13-y14)
ye=2*sqrt(a*a-c*c)
yo=2*sqrt(b*b-d*d)
ze=1/ye
zo=1/yo
1: 1 107.234917897098 24.5190017043023 107.234917897098 24.5190017043023
2: 6 106.105364024421 21.1282783219225 106.105364024421 21.1282783219225
3: 11 106.215060982942 20.7597001994286 106.215060982942 20.7597001994286
4: 16 106.690595211431 20.5790745667766 106.690595211431 20.5790745667766
You can set the same properties on the OutputEquations as you can on Global Equations and Equations:
Sub Main
Dim e As equation
Set e = Project.OutputEquations.Add("x=20",100,100)
eConstrain = True
e.LowerConstraint = 10
e.UpperConstraint = 30
e.Distribution = mwSD_NormalDist
Debug.Print e.x
End Sub
Set e = Project.OutputEquationDocuments.Add("added_in_api")
e.Equations.Add("EQ1 = :PlotVs(""cap:DB(|S(1,1)|)"",""cap:R_PRL(1)"")",-2600,-900)
e.Equations.Add("xa=EQ1+a",-2600,-700)
e.Equations.Add("EQ2 = cap:|ZIN(1)|", -2600,300)
e.Equations.Add("ya = EQ2 + a*100",-2600,500)
e.Equations.Add("deq1 = awr_double(xa)",-2600,900)
End Sub
outputEq.Equations.Add2("X=5", 0, 0)
outputEq.Equations.Add2("Y=X", 0, 100)
outputEq.Equations.Add2("Z=Y", 0, 200)
You can also use Subexpressions as in the following code to add Output Equations referenced each other:
Debug.Clear
Set outputEq = Project.OutputEquationDocuments("Output Equations")
Project.OutputEquationDocuments.Add("test")
Project.OutputEquationDocuments.Remove("test")
If (Project.OutputEquationDocuments.Exists(doc.Name)) Then
Debug.Print "Document " & doc.Name & " exists in the output equations documents collection"
Else
Debug.Print "Document " & doc.Name & " was not found to exist in the output equations doucments
End If
Else
Debug.Print "Document " & doc.Name & " lookup by name succeeded."
End If
Debug.Print ""
Next doc
The following example shows how to access OutputEquations Document by Variable Name:
Debug.Clear
Set outputEq = Project.OutputEquationDocuments("Output Equations")
For Each eqn In outputEq.Equations
Set eqn2 = outputEq.Equations(eqn.Expression)
If eqn2 Is Nothing Then
Debug.Print "Could Not Find " & eqn.Expression & " by Expression"
Else
Debug.Print "Found " & eqn.Expression & " by Expression"
End If
Next eqn
Output Equations includes an Options collection because you need to choose which globals to use for each Output
Equation document.
The following script shows how to access Multiple OutputEquations options and equations:
Debug.Clear
Equation Name:xnew_equations
Option Name = :Equations.Options.Global Definitions Specify the global definition document to use a
Expression:EQ1 = :PlotVs("cap:DB(|S(1,1)|)","cap:R_PRL(1)")
Description:
Constrain:False 0
Expression:xa=EQ1+a
Description:
Constrain:False 0
Expression:xa:
Description:
Constrain:False 0
Expression:xb=EQ1+b
Description:
Constrain:False 0
Expression:xb:
Description:
Constrain:False 0
Equation Name:ynew_equations
Option Name = :Equations.Options.Global Definitions Specify the global definition document to use a
Expression:EQ1 = :PlotVs("cap:DB(|S(1,1)|)","cap:R_PRL(1)")
Description:
Constrain:False 0
Expression:xa=EQ1+a
Description:
Constrain:False 0
Expression:xa:
Description:
Constrain:False 0
The following code provides an example of accessing all Properties of the Output Equation document:
Sub Main
Dim outputEq As OutputEquationDocument
Dim eqn As Equation
Debug.Clear
Set outputEq = Project.OutputEquationDocuments("Output Equations")
For Each eqn In outputEq.Equations
PrintEqn eqn
Next eqn
End Sub
The following code provides an example of creating a new Window or activating an existing Window on the Output
Equation document.
There are standard Document methods and properties accessible, such as modified, read-only, and printing support.
The embedded designs collection provides API access to embedded design views in Output Equations documents.
Sub Main
Dim outeqn As OutputEquationDocument
End Sub
y = 0
h = 1000
w = 2000
outeqn.EmbeddedDesigns.Add("EMS1", mwEDT_EMLayout, 0, y, w, h)
' To add embedded Graph
outeqn.EmbeddedDesigns.Add("Graph 1", mwEDT_Graph, 0, y, w, h)
'To add embedded layout
outeqn.EmbeddedDesigns.Add("SCH1", mwEDT_SchematicLayout, 0, y, w, h)
' To add embedded Shematic
outeqn.EmbeddedDesigns.Add("SCH2",mwEDT_Schematic, 0, 0, 2000, 1000)
To remove embedded design "Graph 1" from Output Equations use the following code:
For i = 1 To outeqn.EmbeddedDesigns.Count
If (outeqn.EmbeddedDesigns(i).DesignName = "Graph 1") Then
index = i
End If
Next i
To remove All embedded design in Output Equations use the following code:
To resize layout embedded design in Output Equations use the following code:
Example4=x
End Function
When you simulate, the Output Equations window displays the following:
Example4
2.5
5
Example3
2
3
Example2
1
2
Example1
abc
5.5
Be careful when you work with Complex equations. The following example does not work:
There is a bug in the scripting engine that prevents a return value from being returned correctly when you specify
'Complex' as the return type. The solution is to omit 'As Complex' in the function declaration so a complex data type is
returned correctly. (See Function Example3 in the previous example).
Note that arithmetic operations over complex data are not implemented, and Complex math operations must be done by
handling the Real and Imaginary components separately, as follows:
Sub Main
Debug.Clear
Dim m As Measurement
Dim mm As Double
Set m = Project.Graphs(Graph 1".Measurements("k:Eqn")
CPoints = m.XpointCount
For i = 1 To cPoints
Debug.Printi;":";m.Xvalue(i)/1e9;vbTab;m.Yvalue(i,2)
Mm = Abs(m.Yvalue(i,2))
Next I
End Sub
Sweeper Object
The Swept Variable Wizard in the NI AWR SDE allows you to create measurements that are plotted not versus frequency,
but versus Element parameters or equations.
The Sweeper object sweeps parameters or equations that are added to the Sweeper object.
Dim sw As Sweeper
Dim e As Equation
Dim p As parameter
Set sw = MWOffice.Project.Sweeper
Set p = Project.Schematics(2).Elements(1).parameters(3)
Set e = Project.Schematics(2).Equations(3)
sw.AddVariable "swv", e ' adding equation
sw.AddVariable "swv", p 'adding parameter
The following script gets an Instance of the Sweeper object from the Project. It gets a reference to the global equation
from the Project.GlobalEquations collection and adds the variable to the Sweeper named "MyLength", then loops through
double values from 1000 to 10,000, incremented by 100, and sweeps the variable by setting, as follows:
Sweeper.Value("MyLength") = <value>.
' Code Module
Sub Main
Dim Swp As Sweeper
Dim myLenVar As Equation
Dim i As Double
Set Swp = Project.Sweeper
Set myLenVar = Project.GlobalEquations("myLength")
Swp.AddVariable("MyLength", myLenVar)
i = 1000
While i < 10000
i = i + 1000
Swp.Value("MyLength") = i
Swp.Update(True, True)
Wend
End Sub
MyLength = 1000
and that a Schematic with three transmission lines is tested, as shown in the following figure.
The length of the middle line depends on the global variable "myLength". If you simulate the Project, bring the Graph
forward, and run the script, you should see how the graph changes as the sweeper changes the variable value. Also, if
you view the Global Definitions window you can see the value in the equation changing.
The following example shows an alternative way of using the Sweeper object:
Sub Main
Debug.Clear
Dim sch As Schematic
Dim e As Element
Dim p As parameter
Set sch = Project.Schematics("Schematic 1")
Set e = sch.Elements(7)
Set p =e.parameters(3)
Debug.Print "Sweeping ";sch.Name;"->";e.Name;"->";p.Name
orgValue = p.ValueAsDouble
count = 2
startVal = 0
stopVal = 180
stepVal = (stopVal-startVal)/(count)
Project.Simulator.Analyze
With Project.Sweeper
.AddVariable("Par",p)
For i=0 To count
'Use the name to refer to a particular parameter
Dim s As SystemDiagrams
For Each s In Project.SystemDiagrams
Debug.Print s.Name
Next s
You can access a specific SystemDiagram by name or by index, like each Element in a collection of objects:
Dim s As SystemDiagrams
Set s = Project. SystemDiagrams ("System Diagram 1")
or
This code assigns the SystemDiagram named "System Diagram 1" to the variable "s" ("s" is a reference to the
SystemDiagram named "System Diagram 1").
After you get a reference to a specific SystemDiagram object, you can perform actions such as the following on a
SystemDiagram:
You can configure the SystemDiagrams options that control all specific settings for a particular SystemDiagram. You
can explore the whole collection of SystemDiagrams options and set a particular option to new value:
i = 1 SampleRate=8
i = 2 DataBlockSize=1000
i = 3 StopTime=80
i = 4 TimeFrame=0.000000001
i = 5 OutputBufferSize=10000
i = 6 DefaultImpedance=-80
i = 7 SamplesPerMeasurement=2000
i = 8 DisplayFrequenciesAsReal=True
i = 9 DisplayFrequenciesUsingCarrrier=True
i = 10 DisplayTimeInTimeUnits=True
i = 11 NormalizeToTimeUnits=True
i = 12 WaveFormsStartFromZero=True
i = 13 AlignWaveFormsToData=True
The Sampling frequency and Symbol time values are accessible through the Options property on both the SystemDiagrams
and SystemDiagram objects. The Sampling frequency is calculated as:
DataRate = 1/TimeFrame
SamplesPerSymbol = SampleRate = 8
The value of SystemDiagram.UseProjectOptions (True/False) determines whether the value comes from the local system
diagram or the collection level options.
You can make modifications the same way you do for the Schematic collection of objects. The key to changing options
at the individual SystemDiagram level is to make sure the UseProjectDefaults property is set to "False". The following
is an example that sets options at the SystemDiagram level:
To create a SystemDiagram you need to use the Add method, which takes one argument, the name of the SystemDiagram
to add. The following code creates a new SystemDiagram named "System Diagram 1" and makes a reference to it:
If a SystemDiagram named "System Diagram 1" already exists, a new SystemDiagram named "System Diagram11" is
created.
Importing a SystemDiagram
Project.SystemDiagrams.Import("import_SDiagr",Project.Path + "SysDiagr.sys")
This fragment of code finds the file (an imported SystemDiagram file has a *.sys extension) and adds the SystemDiagram
to the Project Browser under the name "import_SDiagr". Note that this method as well as the LinkTo method accepts a
Name under which to create the Project Browser node and File Path to the imported or linked file.
To link to the file that contains the SystemDiagram, use the following code:
This code adds a SystemDiagram object link to the collection from a file (a linked SystemDiagram file has a *.sys
extension) and returns a reference to the created object.
The Import method embeds the document into the Project, while the LinkTo method retains a reference and displays the
reference in the Project Browser node name.
You can also perform a Copy to Clipboard operation in the script by using the following CopyToClipboard method:
After completion of the script, the "System Diagram 1" system diagram is stored in the Clipboard.
Exporting a SystemDiagram
This code finds the SystemDiagram ("SysDiagr") and writes a SysDiagr.sys file to the directory ("C:\
My6scripts\SystemDiagram").
The NI AWR SDE allows you to browse through a comprehensive database of hierarchical groups of electrical models
used in SystemDiagrams, and print out all information about the model, such as Name, Description, Category, Symbol
name, Company name, and model Level. You can browse through the Elements manually with the Element Browser
(the System Blocks node) or programmatically via the NI AWR SDE.
You can also iterate through the SystemDiagram Elements Collection in the same way you iterate through the Schematic
Collection of objects.
You can perform the same operations with Elements programmatically that you can manually:
When you have access to a SystemDiagram you can iterate through Elements and parameters collections as usual:
Sub Main
Dim ele As Element
Dim par As parameter
Dim s As SystemDiagram
Debug.Clear
Set s = Project.SystemDiagrams ("System Diagram 1")
'Seeking for Elements and for parameters
l = 0
For Each ele In s.Elements
l=l+1
Debug.Print "Element ";l;": ";ele.Name;vbTab;"Symbol = ";ele.Symbol;
vbTab;ele.RotationAngle;vbTab;"x = ";ele.x;vbTab;"y = ";ele.y
If ele.parameters.Count > 0 Then
k = 0
For Each par In s.Elements(l).parameters
k = k + 1
Debug.Print k;" : ";par.Name;vbTab;par.ValueAsString
Next par
End If
Debug.Print
Next ele
End Sub
To create a new SystemDiagram by adding all Elements, use the following script:
This script creates a new SystemDiagram named "System Diagram 1" and places two Elements on it.
Note that the Add method contains the x and y coordinates of the Element. In this example, Elements connect via a wire.
To connect Elements via wire you need to use the Wires collection of objects. In this script the following code makes a
connection:
sys.Wires.Add(0,0,500,0)
When setting a parameter using ValueAsDouble, the value must be in MKS units. In the following code the line sets the
value of the RATE parameter to 1Hz:
sys.Elements(1).parameters("RATE").ValueAsDouble=1
or
sys.Elements(1).parameters("RATE").ValueAsString="1e9"
You can Rotate and Flip Elements in SystemDiagrams the same way you do in a Schematic. You can also Enable and
Select an Element using Selected and Enabled properties.
To add a Data File to the Element collection, use the following code:
A new Element is added to the SystemDiagram "System Diagram 1" and a subnode named "SGA-3586" displays in the
Project Browser under the System Diagram 1 node.
To add a Subcircuit to the SystemDiagram Elements collection, use the following code:
After running the code, a "SystemSubcircuit" subnode with a subnode named "Ideal filter" displays in the Project Browser.
After running the code, a new equation ("Eb_NO = sweep(stepped(0,9,1))" displays in the SystemDiagram(2). Note that
the Add method accepts the x and y coordinates of the equation.
Also note that if you assign an equation to an Element parameter, the units are set to MKS units on the system diagram.
The model receives the value from the equation in MKS units.
Node y = 900
Processing Nodes for AWGN.A2
Node Index = 1
Node Number = 1
Port Number = 0
Node x = 1600
Node y = 500
Node Index = 2
Node Number = 6
Port Number = 0
Node x = 2600
Node y = 500
Printing out the user attributes for all the system diagrams in the project
The following script writes the user attributes for all the system diagrams in the project:
Code Module
' This script prints the user attributes for all the system diagrams in the project
Sub Main
Dim ele As Element
Dim sys As SystemDiagram
Dim prop As Property
project_path=Project.Path
fn$=Project.Path & Replace(Project.Name,".emp","") & "_user_att.csv"
System Diagram 11
System Diagram 11:1
Set s = Project.SystemDiagrams("a")
Debug.Print s.SweepVariables.Count
For Each sv In s.SweepVariables
Debug.Print sv.Name & vbTab & sv.Values.Count
Next
End Sub
MWOffice.Activate
SendKeys("^0") ' Start the system simulator
While curTime < stopTime
Wait 5 'Check the time every 5 seconds
SendKeys("^9") ' Need to set "ctrl-9" as the pause/unpause System
'Sim hotkey
' The simulator needs to be paused for these next 'two commands,
' otherwise things could change in between the 'if' and the next 'command.
If Project.Graphs("SimTime").Measurements(1).XPointCount Then
curTime = Project.Graphs("SimTime").Measurements(1).XValue(1)
Debug.Print curTime
End If
SendKeys("^9") 'unpause the simulator
Wend
SendKeys("^0") 'Stop the system simulator
End Sub
NOTE: You can add hotkeys via the API, although the API is not designed for use by an external customization editor
so the settings are not remembered from one session to the next.
At times, you may run the system simulator, need to make changes in the system diagram, and then need to run the
system simulator again. The following script shows how to do this using events, and how to avoid a system simulation
loop:
need_sim = True
Project.Simulator.Start
End Sub
l=l+1
If ele.Parameters.Count > 0 Then
If ele.Name = "AMP_EQN.A2" Then
We added a start-up state for the system simulator API. Because the systems simulator is started by posting a message
similarly to the way the UI starts it and the start method returns right after the message is posted it is possible for additional
API calls to be processed before the simulator moves into the running stage. This can result in getting a status of
mwSSS_Stopped prior to the simulator moving into the mwSSS_running stage. This is particularly true since to avoid
during startup the system simulator pumps waiting messages to preventing hanging any UI update events this can also
allow processing of API calls. We added an additional state mwSSS_Starting which will be set immediately in the
request to start the simulator. Once the simulator has transitioned to running the get simulator state will report running,
it will move the state into mwSSS_Running, then at some point in the future when the system simulator is stopped the
Simulator.State() call will return mwSSS_Stopped. This way the states will go immediately into starting and then
transition to running once the simulator is up and running.
With this approach the user can distinguish between three states (starting), (running) and (stopped). Often what is desired
especially with a cycle simulator such as the system simulator is to know when it is actually running. In this case the
transition from (starting) to (running) should provide the desired point. added an additional state mwSSS_Starting which
I place the Simulator.State() return value into immediately before returning. So when you do Simulator.Start() the only
two following values you should get are mwSSS_Starting or mwSSS_Running depending on how fast the simulator
starts. You should always get at least mwSSS_Starting, but if the simulator starts quickly the next call to get the state
may indicate that it is running.
So the program that wanted to do something while the simulator was running:
Project.Simulator.Start
MsgBox("Done!")
End Sub
While(Project.Simulator.State = mwSSS_Running)
' Do stuff while running.
Wend
MsgBox("Done!")
End Sub
Dim t1 As Double
Dim t2 As Double
t2 = Timer
t = awr_timer(t1,t2)
fn = AWR_get_perf_file
Open fn For Append As #1
tks = Split(Project.Name,".")
Print #1, Chr(34) & tks(0) & "@sim_time" & Chr(34) & vbTab & t
Close #1
End Sub
End If
awr_timer = tt
End Function
Function AWR_get_perf_file() As String
Dim objFileSystem As Scripting.FileSystemObject
Set objFileSystem = New Scripting.FileSystemObject
bd = MWOffice.BuildNumber ' need to be able to get minor number, need that in the API.
'folder location
pth = MWOffice.Directories(2).ValueAsString & "\testresults\"
'pth = "C:\AWR_PerfLogs\"
'check to make sure path exists, more for testing than running code.
If objFileSystem.FolderExists(pth) = False Then
objFileSystem.CreateFolder(pth)
End If
fn = pth & "DesEnv_B" & MWOffice.BuildNumber & "_R" & MWOffice.BuildRevision & ".per"
If objFileSystem.FileExists(fn) = False Then
Open fn For Output As #1
Debug.Print """Name""" & vbTab &"""Time(s)$T"""
Close #1
End If
AWR_get_perf_file = fn
End Function
Set mylib=MWOffice.Libraries(1)
process_library mylib
End Sub
Sub process_library(mylib As Library)
End Sub
The NI AWR SDE provides access to the Name and Browser path for the LibraryElement, and also to the Element
description and default Symbol name of the LibraryElement via collection of the attributes for the properties of
LibraryElement objects. The attributes collection can be used for the different library Element types (model, xml,
subcircuit, datafile) with attributes appropriate for the Element type.
The following script adds process library to the project: (The library .ini file should be at the same directory as the project)
The following script also adds a new process library to the project from the example_pdks:
Project.Schematics(1).Elements.AddLibraryElement("BP:\Circuit Elements\Libraries\*Generic Ge
End Sub
Note that in the previous example we use Application collection of objects to find out the path to the Directories collection
of objects. The Application collection of objects can also be used to get access to Files, Measurements, Models, and
System Models Collections of objects.
The following script adds a Library Element to the Global Definitions Document to demonstrate adding Elements by
Library browser path. This code adds a library Element to two separate Global Definition Documents and then checks
to see that they display correctly in the Data Elements collections for these Documents.
End Sub
If doc.DataElements.Exists(elem.Name) Then
Debug.Print "Element named " & elem.Name & " exists in the data elements collection."
Else
Debug.Print "Element named " & elem.Name & " not-found in the data elements collection."
End If
End Sub
The following script shows AddLibraryElement method for placing elements based upon MDIF and GMDIF files to
schematic:
Project.Schematics(1).Elements.AddLibraryElement("BP:\Circuit Elements\Libraries\Test\WPP1530_PHEM
Project.Schematics(1).Elements.AddLibraryElement("BP:\Circuit Elements\Libraries\Test\WPP1530_PHEM
The following script creates a schematic that contains an XML schematic, exports the schematic and import back to the
project:
schem_name = "Foundry_Lib_Cells"
Set schem = Project.Schematics.Add(schem_name)
schem.Elements.AddLibraryElement(bp, 0, 0)
schem.Export("\C:\User_Test\schem.sch")
Project.Schematics.Import("schem" , "C:\User_Test\schem.sch")
End Sub
The following script gets the browser path from the XML library element and add a library element to a schematic:
The following script shows access to the installed process libraries. This allows the user to get a list of the libraries that
can be used with the API NewWithLibrary() call which creates a new project with an associated PDK library (the same
list under File > New With Library...):
Debug.Clear
Debug.Print "Library Count = " & MWOffice.AvailableProcessLibraries.Count
Depending of what libraries are included the output can look as follows:
Library Count = 25
Debug.Clear
For Each procLib In Project.ProcessLibraries
Debug.Print procLib.Name
Debug.Print procLib.IniFilePath
Debug.Print procLib.Version
Next procLib
End Sub
sl.ViewNames = newNames
You can create scripts inside the NI AWR SDE as well as scripts in other programming languages, and run them outside
of the NI AWR SDE.
The following code example starts the NI AWR SDE (if it is not already running) and establishes the variable objMWO
to refer to an object of the Application class.
The following script shows how to automate the consecutive simulation of more than one Project. This script may run
externally in a Visual Basic IDE.
Sub Main
Dim objMWO
Dim Mdl
Dim Text
Set objMWO = MWOffice.Application
objMWO.Visible = True
' Make a list of all project in TT directory - file_Names(num_files)
For i = 0 To num_files - 1
ObjMWO.Open (num_files(i))
For Each s In ObjMWO. Project.Schematics
The following code is using Excel to display a multiselect file open dialog. We can use it for example to plot a lot of
files into MWOffice simultaneously:
Dim fd As FileDialog
fd = excel.FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = True
fd.Show()
Debug.Print fd.SelectedItems(1)
Debug.Print fd.SelectedItems(2)
Debug.Print fd.SelectedItems(3)
End Sub
To use the code do not forget to reference to the Microsoft Office Object Library.
' Script creates a bill-of-materials for each schematic in the project and exports the results to
' Requires Microsoft Excel be installed on the machine.
Sub Main
Dim schem As Schematic
Dim elem As Element
Dim excel As Object
Dim workBook As Object
Dim sheet As Object
Dim partNum As Object
' Create an instance of Excel
Set excel = CreateObject("Excel.Application")
excel.Visible = True
excel.Interactive = True
Set workBook = excel.Workbooks.Add()
Notice that you need to use an absolute path before calling Open.
To repeatedly open the NI AWRDE, execute commands, and then close the program, use the Quit method which posts
a CM_EXIT command message to the Application object:
MWOffice.Application.Quit
If the Project state is set as Saved, you can use Close to exit without saving a dirty Project. To run without the Save
Changes dialog box displaying, use the following script:
Sub RunMWOScript()
Dim objMWO As MWOffice.Application
End Sub
Do not forget to add a reference from Excel to the AWR Design Environment Current Version ( for example v11.0) in
the References menu in Excel. After running this Macro in Excel the MWOffice script will be executed.
Module Module1
Dim objFileSystem As Scripting.FileSystemObject
Dim mwoffice2 As MWOffice.Application
Dim pathr As String
Sub Main()
'need to add a way for specific projects to be skipped meaning it is okay to have saved dat
objFileSystem = New Scripting.FileSystemObject
'start Microwave Office
mwoffice2 = CreateObject("AWR.MWOffice.10.0")
'mwoffice2 = CreateObject("AWR.MWOffice.9.0")
mwoffice2.TestMode = True
'MsgBox("make sure test mode is turned on in Microwave Office")
pathr = "C:\Subversion\buildtests\trunk\buildtests\Examples\60 Examples\Linear"
process(pathr)
End Sub
Sub process(ByVal nm As String)
Dim subFile As Scripting.File
Dim newFolder As Scripting.Folder
newFolder = objFileSystem.GetFolder(nm)
End Module
Sub CreateAndSaveANewProject
MWOffice.New
Project.Name = "SomeName" ' Warn if bad name
' To do: Add some things to the project
Project.Save
End Sub
When creating a new Project, use MWOffice.New() instead of MWOffice.New(" "). Including a space in the file name
makes it invalid, and you cannot save the file.
Sub CreateAndSaveANewProject
Project.New
Project.Name = "SomeName" ' Warn if bad name
' Todo: Add some things to the project
Project.Save
End Sub
Debug.Print "Count=";MWOffice.Windows.Count
Debug.Print "Count=";Windows.Count
However if user writes the following
Debug.Print "Count=";Count
This code creates a new automatic variable named 'Count' which has no type and no value, so nothing is printed. Note
that variables do not need to be declared before they are used in Basic; new variables are automatically created as you
use them. You can avoid this problem by using the "Option Explicit" declaration at the top of the Basic file, which
requires all variables to be explicitly declared.
The following is an example using the MWOffice.Left property, where in one place in the code "Left" there is a reference
to the MWOffice.Left property. Since Left is a keyword for a function in Basic, just referring to "Left" causes an interpreter
syntax error.
Debug.Print "Left=";Left ' Syntax Error, trying to call the Left() basic
'function without parentheses?
Debug.Print "Left=";MWOffice.Left ' Returns the left side of the window.
MWOffice.Width = 300
MWOffice.Height = 200
The Windows collection is a property of the NI AWR SDE MWOffice object, and all MWOffice object properties and
methods are included in the global namespace, so
Windows(2).Close
is the same as
MWOffice.Windows(2).Close
Note that the Windows collection, like most collections, has a default property called Item, which allows you to access
a specific window via index, so the expression
Windows(2).Close
MWOffice.Windows.Item(2).Close
The NI AWR SDE supports tiling the Windows collection in MWOffice using a tile method with an argument for direction
(vertical or horizontal):
MWOffice.Windows.Tile(mwWTD_Horizontal)
MWOffice.Windows.Tile(mwWTD_Vertical)
Option Explicit
Sub Main
Dim wins As Windows
Dim win As Window
Dim hWn As Window
Dim hWnd As Long
Dim opt As Option
Debug.Clear
For Each win In Windows
Debug.Print win.Caption
Next win
Debug.Print "The window handle of the NI AWRDE main window = ";MWOffice.hWnd
End Sub
Constellation
BER Table
BER
EM Lange
System Diagram 1
Schematic 1
The window handle of the NI AWR SDE main window = 2359432
To loop through the open Windows in the Project and print the Window type, use the following code:
MWOffice.Activate
Dim w As Window
For Each w In MWOffice.Windows
Debug.Print w.Caption; w.Type
Next w
Debug.Clear
For Each jq In MWOffice.JobControlMonitor.Queues
Debug.Print "Name = " & jq.Name & " Local = " & jq.Local
Debug.Print "Entry Count = " & jq.Entries.Count
For Each je In jq.Entries
Debug.Print "Job #" & je.Id & ", Name = " & je.Name
Debug.Print " Status = " & je.Status
Debug.Print " Description = " & je.Description
Debug.Print " Project = " & je.Project
Debug.Print " Owner = " & je.Owner
Debug.Print " Start = " & je.StartTime
Debug.Print " HasStarted = " & je.HasStarted
Debug.Print " IsRunning = " & je.IsRunning
Debug.Print " HasEnded = " & je.HasEnded
Debug.Print " ExitCode = " & je.ExitCode
For Each attr In je.Details
Debug.Print " " & attr.Name & " = " & attr.Value
Next attr
Debug.Print ""
Next je
Debug.Print ""
Next jq
End Sub
API is providing access to job scheduler resources, for queues and job entries. It is also providing access to available job
queues defined in the settings and state of job entries in the job queues, (i.e. pending, running, completed). API allows
users to determine things like if simulation processes are still running or have been completed. JobQueue objects in the
JobMonitor can read the details for the ipc connection libraries and interfaces. Job queue details can indicate if the queue
is local or remote.
API provides some additional properties for JobEntry objects to check the state of the task. For example, HasStarted,
IsRunning, and HasEnded. There is also access to the Exit Code if the task has ended. Details attribute collection provides
a collection of name /value pairs of the detailed attributes available for each job entry.
API supports basic job control methods on JobEntry objects. These include pause, resume, and cancel. These methods
are from basic level of job management similar to what is available from the Job Monitor window.
The following example of code going through JobControlMonitor Queues collection of objects and counts
JobControlMonitor Queues with different methods of access:
nQue1 = MWOffice.JobControlMonitor.Queues.Count
nQue2 = 0
For Each queue In MWOffice.JobControlMonitor.Queues
nQue2 = nQue2 + 1
Next queue
End Sub
End Sub
End Sub
Code similar to the following can be used to make a project not read-only:
Project.Save
End Sub
If FO Is Nothing Then
MsgBox( "BrowseForFolder failed to get a folder",vbOkOnly, "Error Window")
Else
For Each fi In currFolder.Files
fi.Delete
Next fi
End If
End Sub
Using API file attribute classes to access file attributes for objects in the file utility
interfaces.
The following code can be used to access information of the File System structure attributes:
PrintFileInfoDetails(Project.Path + "File1.txt")
PrintFileInfoDetails(Project.Path + "File2.txt")
PrintFileInfoDetails(Project.Path + "File3.txt")
PrintFileInfoDetails(Project.Path + "Dir1")
End Sub
Set fi = FileUtil.GetFileInfo(filepath)
Debug.Print "File Name = " & fi.Name
Debug.Print "File Extension = " & fi.Extension
Debug.Print "File Exists = " & fi.FileExists
PrintBrowseForFolderdetails bffd
End Sub
Using API methods to explore the browse for file path dialog.
In the following code we don't invoke the dialog, the code can be used to call each of the methods to get values:
PrintFilePathDialogDetails fpd
End Sub
Next fp
End Sub
The following code creates a new archive, then opens the resulting archive and enumerates and outputing the contents:
delete_if_exists(arcName)
Set ar = FileUtil.NewZipArchive(arcName)
If ar.IsValid Then
Debug.Print "Archive is Valid."
bRet = ar.AddFile(Project.Path + "File1.txt")
Debug.Print "Add File1.txt returned: " & bRet
ar.Close
Else
Debug.Print "Unable to create valid archive with name: " & arcName
End If
Set fi = FileUtil.GetFileInfo(arcName)
If fi.FileExists Then
Debug.Print "Successfully created archive output file."
Else
Debug.Print "Failed to create archive output file."
End If
If (zItems.Valid) Then
End Sub
The following code is accessing the File attributes inside the zip Archive:
Dim ar As ZipArchiveWriter
Dim zItem As ZipArchiveItem
Dim zItems As ZipArchiveItems
delete_if_exists(arcName)
Set ar = FileUtil.NewZipArchive(arcName)
If ar.IsValid Then
Debug.Print "Archive is Valid."
bRet = ar.AddFile(Project.Path + "File1.txt")
Debug.Print "Add File1.txt returned: " & bRet
ar.Close
Else
Debug.Print "Unable to create valid archive with name: " & arcName
End If
Set fi = FileUtil.GetFileInfo(arcName)
If fi.FileExists Then
Debug.Print "Successfully created archive output file."
Else
Debug.Print "Failed to create archive output file."
End If
If (zItems.Valid) Then
Debug.Print "Successfully Opened archive input file."
Debug.Print "Archive Items:"
For Each zItem In zItems
Debug.Print "Name = " & zItem.Name
Debug.Print "Extension = " & zItem.Extension
Debug.Print "Comp Size = " & zItem.CompressedSize
Debug.Print "UnComp Size = " & zItem.UncompressedSize
Debug.Print "Attributes:"
For Each fa In zItem.Attributes
Debug.Print " " & fa.Name & " = " & fa.Value
Next fa
Next zItem
Else
Debug.Print "Failed to open created archive file."
End If
End Sub
This script adds the files File1.txt, File2.txt, File3.txt and Directory Dir1 to the zip archive. When a directory is added
to a zip archive all files and directories below the directory will also be added. That is, adding a directory recursively
adds the files and directories below it.
The following code is for individual zip file operations that confirms the contents of the resulting zip file. The code
incorporates both the zip file reader and writer to create archives using the writer commands and then opens and reads
the contents to verify correct construction for each type of zip file:
delete_if_exists(arcName)
Set ar = FileUtil.NewZipArchive(arcName)
If ar.IsValid Then
ar.Close
Else
Debug.Print "Unable to create valid archive with name: " & arcName
End If
Set fi = FileUtil.GetFileInfo(arcName)
If fi.FileExists Then
Debug.Print "Successfully created archive output file."
Else
Debug.Print "Failed to create archive output file."
End If
If (zItems.Valid) Then
Debug.Print "Successfully Opened archive input file."
Debug.Print "Archive Items:"
For Each zItem In zItems
Debug.Print "Name = " & zItem.Name
Debug.Print "Extension = " & zItem.Extension
Debug.Print "Comp Size = " & zItem.CompressedSize
Debug.Print "UnComp Size = " & zItem.UncompressedSize
Next zItem
Else
Debug.Print "Failed to open created archive file."
End If
End Sub
delete_if_exists(arcName)
Set ar = FileUtil.NewZipArchive(arcName)
If ar.IsValid Then
Debug.Print "Archive is Valid."
ar.Close
Else
Debug.Print "Unable to create valid archive with name: " & arcName
End If
Set fi = FileUtil.GetFileInfo(arcName)
If fi.FileExists Then
Debug.Print "Successfully created archive output file."
Else
Debug.Print "Failed to create archive output file."
End If
If (zItems.Valid) Then
Debug.Print "Successfully Opened archive input file."
Debug.Print "Archive Items:"
For Each zItem In zItems
Debug.Print "Name = " & zItem.Name
Debug.Print "Extension = " & zItem.Extension
Debug.Print "Comp Size = " & zItem.CompressedSize
Debug.Print "UnComp Size = " & zItem.UncompressedSize
Next zItem
Else
Debug.Print "Failed to open created archive file."
End If
End Sub
delete_if_exists(arcName)
Set ar = FileUtil.NewZipArchive(arcName)
If ar.IsValid Then
Debug.Print "Archive is Valid."
bRet = ar.AddFile(Project.Path + "File1.txt")
ar.Close
Else
Debug.Print "Unable to create valid archive with name: " & arcName
End If
Set fi = FileUtil.GetFileInfo(arcName)
If fi.FileExists Then
Debug.Print "Successfully created archive output file."
Else
Debug.Print "Failed to create archive output file."
End If
If (zItems.Valid) Then
Debug.Print "Successfully Opened archive input file."
Debug.Print "Archive Items:"
For Each zItem In zItems
Debug.Print "Name = " & zItem.Name
Debug.Print "Extension = " & zItem.Extension
Debug.Print "Comp Size = " & zItem.CompressedSize
Debug.Print "UnComp Size = " & zItem.UncompressedSize
Next zItem
Else
Debug.Print "Failed to open created archive file."
End If
End Sub
delete_if_exists(arcName)
Set ar = FileUtil.NewZipArchive(arcName)
If ar.IsValid Then
Debug.Print "Archive is Valid."
ar.Close
Else
Debug.Print "Unable to create valid archive with name: " & arcName
End If
Set fi = FileUtil.GetFileInfo(arcName)
If fi.FileExists Then
Debug.Print "Successfully created archive output file."
Else
Debug.Print "Failed to create archive output file."
End If
End Sub
Code similar to the following can be used to access Design Notes information:
PrintDesignNoteDetails dn
Next dn
End Sub
If Project.DesignNotes.Exists(dn.Name) Then
Debug.Print "Design Note exists by name succeeded"
Else
Debug.Print "Design Note exists by name failed"
End If
delete_if_exists(fname)
Project.DesignNotes(1).Export(fname)
If FileUtil.GetFileInfo(fname).FileExists Then
Debug.Print "Design Note Export Succeeded"
Else
Debug.Print "Design Note Export Failed
End If
Project.DesignNotes(1).Import(fname)
End Sub
Set dn = Project.DesignNotes(1)
Set win = dn.NewWindow
If dn.Windows.Exists(win.Caption) Then
Debug.Print "Window exists by name succeeded"
Else
Debug.Print "Window exists by name failed"
End If
win.Close
End Sub
The following is the API method on window object to center a window relative to its parent window. This can be used
to center a MDI child window relative to the MDI client area of the AWR DE. For example the following code could be
used to open a Design Note window. Ensure it is the active (front) window and then center that window in the MDI client
area of the AWR DE:
This script prints the script module name followed by the path for each script module in the global scripts collection.
This tool allows importing and exporting individual schematics and project symbols from/to ADS and Virtuoso OpenAccess
databases. See OpenAccess Import/Export Wizard for more information.
The NI AWRDE API has support for the OpenAccess Import/Export Wizard. In a script, prepare to use the wizard with
the following code:
Settings that can be configured or queried using the PutOption and GetOption methods:
The AWR Design Environment API Is implemented As a Component Object Model (COM) Automation-compliant API.
This allows the AWR Design Environment Application To act As a COM Automation Server whose Object Model can
be controlled from Any programming language (such As Visual C++) Or Scripting engine (such As Visual Basic Or
Java Script) that can act As an COM Automation Client, providing you With unlimited ways To extend the capabilities
of AWR Design Environment. It allows you To create scripts To Do things such As automate Complex tasks, And author
wizards To Do things such As implement add-On tools. Scripts And Wizards appear As groups In the AWR Design
Environment design environment's Project View.
Objects List
Object Name Description
Annotation A MWOffice Annotation object.
Annotations A collection of MWOffice Annotation objects.
Application The MWOffice application object.
Argument An MWOffice Argument object.
Arguments A collection of MWOffice Argument objects.
Attribute An MWOffice Attribute object.
Attributes A collection of MWOffice Attribute objects.
AutoSearchMarker An MWOffice AutoSearchMarker Object.
Axes A collection of MWOffice Axis objects.
Axis An MWOffice Axis object.
Boundary An MWOffice Boundary object.
BoundaryModel An MWOffice BoundaryModel object.
BrowseForFolderDialog An MWOffice BrowseForFolderDialog object.
BundleBit An MWOffice BundleBit object.
BundleBits A collection of MWOffuce BunldeBit objects.
BundleBus An MWOffice BundleBus object.
BundleBuses A collection of MWOffice BundleBus objects.
BundleInfo An MWOffice BundleInfo object.
BundleInfos A collection of MWOffice BundleInfo objects.
BusNetName An MWOffice BusNetName object.
BusNetNames A collection of MWOffice BusNetName objects.
CSelectFilters A collection of MWOffice SelectFilter objects.
Cell An MWOffice Cell object.
CellEditor An MWOffice CellEditor object.
Enumerations List
Enumeration Name Description
mwAlignToolFlags Constants that define the types of alignment tools.
mwApplicationAttributeType Constants that define different types of application attribute types
mwApplicationDirectoryType Constants that define different types of application directories.
mwApplicationFileType Constants that define different types of application files.
mwArcAttributes Constants that define different types of Arc attributes.
mwAreaAddType Constants that define different constraints for adding objects in an area
mwArrayCellAttributes Constants that define attributes of an array cell object.
mwBooleanCornerStyles Constanst that define the different types of corner styles that can be used when
resizing shapes with acute angles
mwBooleanEngineVersions Constanst that define the different types of boolean engines that can be used for
shape processing in layout.
mwBoundaryModelType Constants that define different types of boundary models.
mwCellExportFormat Constants that define different types of cell export formats.
mwCellLibraryType Constants that define the different cell library types.
mwCellStretcherAttributes Constants that define different attribute types for cell stretcher shapes
mwColor Constants that define different types of standard colors.
mwComponentTestResultType Constants that define the different types of component test result types.
mwDashStyle Constants that define the dash styles of a line.
mwDataFileType Constants that define different types of data files.
mwDataSetFlags Constants that define flag types associated with data sets.
mwDefRouteConnModelTypes Constants that define different types of route-to-route connection models.
mwDefaultFaceAlignType Constants that define different types of default face alignments.
mwDesignRuleErrorFileFormat Constants that define different types of DRC error file formats.
mwDesignRuleState Constants that define different types of design rule states
mwDesignRuleType Constants that define different types of design rule types
mwDesignViewType Constants that defined different views on a design
mwDiagramLockLevel Constants that define different types of lock levels for schematic and system
diagrams
mwDimensionArrowLocation Constants that define different types of arrow locations for dimension line objects.
mwDimensionTextLocation Constants that define different types of text locations for dimension line objects.
mwDisplayModeType Constants that define the different types of drawing object display modes.
mwDockBorder Constants that define the locations that a window can be docked to.
mwDockState Constants that define the different dockable states of a window.
mwDrawingArcDirection Constants that define different arc segment directions.
mwDrawingShapeType Constants that define different types of drawing shape objects.
mwDrawingSubObjectType Constants that define differnet types of drawing sub-objects.
Count
This page is for the common property Count and all the objects that use this property.
Add
This page is for the common method Add and all the objects that use this method.
Remove
This page is for the common method Remove and all the objects that use this method.
Clear
This page is for the common method Clear and all the objects that use this method.
Name
This page is for the common property Name and all the objects that use this property.
Value
This page is for the common property Value and all the objects that use this property.
Activate
This page is for the common method Activate and all the objects that use this method.
NewWindow
This page is for the common method NewWindow and all the objects that use this method.
Print
This page is for the common method Print and all the objects that use this method.
Caption
This page is for the common property Caption and all the objects that use this property.
Delete
This page is for the common method Delete and all the objects that use this method.
Exists
This page is for the common property Exists and all the objects that use this property.
Copy
This page is for the common method Copy and all the objects that use this method.
Ccopy
This page is for the common method Ccopy and all the objects that use this method.
Update
This page is for the common method Update and all the objects that use this method.
Import
This page is for the common method Import and all the objects that use this method.
LinkTo
This page is for the common method LinkTo and all the objects that use this method.
Coptions
This page is for the common property Coptions and all the objects that use this property.
Application
The MWOffice application object.
Properties
Methods
Activate
Returns: Void
CreateEMail
Returns: EMail
Dispose
Returns: Void
InvokeCommand
Description: Invoke a application level menu command by name. Any required input will need to be supplied in the
arguments.
Returns: Void
New
Returns: Boolean
NewWithProcessLibrary
Returns: Void
Open
Returns: Boolean
Quit
Returns: Void
SendEMail
Returns: Boolean
StartCommand
Description: Start a application level menu command by name. Any required input will need to be supplied by the user
interactively.
Returns: Void
Events
NewProject
Returns: HRESULT
OpenProject
Returns: HRESULT
ProjectAfterClose
Returns: HRESULT
ProjectAfterSave
Returns: HRESULT
ProjectBeforeClose
Returns: HRESULT
ProjectBeforeSave
Returns: HRESULT
ProjectOpen
Returns: HRESULT
Options
Project
An MWOffice Project object.
Properties
Methods
Close
Description: Closes the project and all windows associated with the project.
Returns: Void
Import
Returns: Void
ImportTestbench
Returns: Void
NewGlobalEquationsWindow
Returns: Window
NewOutputEquationsWindow
Returns: Window
Save
Description: Saves changes to the project file specified in the project's FullName property.
Returns: Boolean
SaveAs
Returns: Void
SaveAsTemplate
Returns: Void
SaveAsVersion
Returns: Void
Events
AfterSave
Returns: HRESULT
AfterSimulate
Returns: HRESULT
AfterSystemSimulate
Returns: HRESULT
BeforeClose
Returns: HRESULT
BeforeSave
Returns: HRESULT
BeforeSimulate
Returns: HRESULT
BeforeSystemSimulate
Returns: HRESULT
CellLibraryAfterRemove
Returns: HRESULT
CellLibraryAfterRename
Returns: HRESULT
CellLibraryBeforeRemove
Returns: HRESULT
CellLibraryBeforeRename
Returns: HRESULT
DataFileAfterRemove
Returns: HRESULT
DataFileAfterRename
Returns: HRESULT
DataFileBeforeRemove
Returns: HRESULT
DataFileBeforeRename
Returns: HRESULT
EMStructureAfterRemove
Returns: HRESULT
EMStructureAfterRename
Returns: HRESULT
EMStructureBeforeRemove
Returns: HRESULT
EMStructureBeforeRename
Returns: HRESULT
GraphAfterRemove
Returns: HRESULT
GraphAfterRename
Returns: HRESULT
GraphBeforeRemove
Returns: HRESULT
GraphBeforeRename
Returns: HRESULT
GraphNewMeasurement
Returns: HRESULT
NetlistAfterRemove
Returns: HRESULT
NetlistAfterRename
Returns: HRESULT
NetlistBeforeRemove
Returns: HRESULT
NetlistBeforeRename
Returns: HRESULT
New
Returns: HRESULT
NewCellLibrary
Returns: HRESULT
NewDataFile
Returns: HRESULT
NewEMStructure
Returns: HRESULT
NewGraph
Returns: HRESULT
NewNetlist
Returns: HRESULT
NewOptGoal
Returns: HRESULT
NewOutputFile
Returns: HRESULT
NewProcessDefinition
Returns: HRESULT
NewSchematic
Returns: HRESULT
NewSystemDiagram
Returns: HRESULT
NewYieldGoal
Returns: HRESULT
Open
Returns: HRESULT
OptGoalAfterChange
Returns: HRESULT
OptGoalAfterRemove
Returns: HRESULT
OptGoalAfterToggleEnable
Returns: HRESULT
OptGoalBeforeChange
Returns: HRESULT
OptGoalBeforeRemove
Returns: HRESULT
OptGoalBeforeToggleEnable
Returns: HRESULT
OptimizerIteration
Returns: HRESULT
OptimizerStarted
Returns: HRESULT
OptimizerStopped
Returns: HRESULT
OutputFileAfterRemove
Returns: HRESULT
OutputFileAfterRename
Returns: HRESULT
OutputFileBeforeRemove
Returns: HRESULT
OutputFileBeforeRename
Returns: HRESULT
ProcessDefinitionAfterChange
Returns: HRESULT
ProcessDefinitionAfterRemove
Returns: HRESULT
ProcessDefinitionBeforeChange
Returns: HRESULT
ProcessDefinitionBeforeRemove
Returns: HRESULT
SchematicAfterRemove
Returns: HRESULT
SchematicAfterRename
Returns: HRESULT
SchematicBeforeRemove
Returns: HRESULT
SchematicBeforeRename
Returns: HRESULT
SchematicElementAfterRemove
Returns: HRESULT
SchematicElementBeforeRemove
Returns: HRESULT
SchematicNewElement
Returns: HRESULT
SystemDiagramAfterRemove
Returns: HRESULT
SystemDiagramAfterRename
Returns: HRESULT
SystemDiagramBeforeRemove
Returns: HRESULT
SystemDiagramBeforeRename
Returns: HRESULT
SystemDiagramElementAfterRemove
Description: Occurs after an Element has been removed from a System Diagram.
Returns: HRESULT
SystemDiagramElementBeforeRemove
Returns: HRESULT
SystemDiagramNewElement
Returns: HRESULT
YieldAnalysisIteration
Returns: HRESULT
YieldAnalysisStarted
Returns: HRESULT
YieldAnalysisStopped
Returns: HRESULT
YieldGoalAfterChange
Returns: HRESULT
YieldGoalAfterRemove
Returns: HRESULT
YieldGoalAfterToggleEnable
Returns: HRESULT
YieldGoalBeforeChange
Returns: HRESULT
YieldGoalBeforeRemove
Returns: HRESULT
YieldGoalBeforeToggleEnable
Returns: HRESULT
Options
ProjectFile
A MWOffice ProjectFile object.
Properties
ProjectFiles
A collection of MWOffice ProjectFile objects.
Properties
ControlBar
An MWOffice ControlBar object.
Properties
Methods
Dock
Returns: Void
Float
Returns: Void
LoadSettings
Returns: Void
SaveSettings
Returns: Void
ControlBars
A collection of MWOffice ControlBar objects.
Properties
Methods
None
DataFile
An MWOffice Datafile object.
Properties
Methods
Activate
Returns: Void
Export
Returns: Boolean
NewWindow
Returns: Window
PrintOut
Returns: Void
DataFiles
A collection of MWOffice Datafile objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: DataFile
Syntax: Function Add(Name As String, Filename As String, Embedded As Boolean, Type As mwDataFileType) As
DataFile
AddNew
Description: Adds an object to the collection and returns a reference to the created object.
Returns: DataFile
Copy
Description: Copies an object from another object collection into this object collection.
Returns: DataFile
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: DataFile
LinkTo
Description: Adds a DataFile object link to the collection from a file and returns a reference to the created object.
Returns: DataFile
Remove
Returns: Boolean
DataSetProperty
An MWOffice DataSetProperty object.
Properties
DataSetProperties
A collection of MWOffice DataSetProperty objects.
Properties
DataSet
An MWOffice DataSet object.
Properties
Methods
UpdateClock
Returns: Void
UpdateResults
Returns: Void
DataSets
A collection of MWOffice DataSet objects.
Properties
Methods
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
DataSetFolder
An MWOffice DataSetFolder object.
Properties
DataSetFolders
A collection of MWOffice DataSetFolder objects.
Properties
Methods
AddGraphDataSet
Description: Adds an object to the collection and returns a reference to the created object.
Returns: DataSet
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: DataSet
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
OutputFile
An MWOffice OutputFile object.
Properties
OutputFiles
A collection of MWOffice OutputFile objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: OutputFile
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Void
Frequency
An MWOffice Frequency object.
Properties
Frequencies
A collection of MWOffice Frequency objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Frequency
AddMultiple
Returns: Void
Clear
Returns: Boolean
Remove
Returns: Boolean
Element
An MWOffice Element object.
Properties
Methods
Delete
Returns: Boolean
Move
Description: Moves DrawingShape object by the given values relative to the current location.
Returns: Boolean
Syntax: Function Move(dx As Long, dy As Long, [CCWRotatation As Double = 0], [Flip As Boolean = 0], [HorizontalAxis
As Boolean = 0], [OriginX As Double = 0], [OriginY As Double = 0]) As Boolean
Options
Elements
A collection of MWOffice Element objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Element
Syntax: Function Add(Name As String, x As Long, y As Long, [RotationAngle As Long = 0], [Flipped As Boolean =
0], [Symbol As String = ""]) As Element
AddDataFile
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Element
Syntax: Function AddDataFile(Path As String, x As Long, y As Long, [Embedded As Boolean = -1], [RotationAngle
As Long = 0], [Flipped As Boolean = 0], [Symbol As String = ""]) As Element
AddLibraryElement
Description: Adds a LibraryElement specified by browser path to the collection and returns a reference to the created
object.
Returns: Element
AddModelFile
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Element
Syntax: Function AddModelFile(Path As String, x As Long, y As Long, [DefaultName As String = ""], [Type As
mwModelParseType = 0], [RotationAngle As Long = 0], [Flipped As Boolean = 0], [Symbol As String = ""]) As Element
AddSubcircuit
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Element
AddXMLComponent
Description: Adds a XML component specified by an XPath to the collection and returns a reference to the created
object.
Returns: Element
Syntax: Function AddXMLComponent(XPath As String, x As Long, y As Long, [RotationAngle As Long = 0], [Flipped
As Boolean = 0], [Symbol As String = ""]) As Element
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
SelectedElements
A collection of MWOffice SelectedElement objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
AddAll
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
EquationExpression
A MWOffice EquationExpression object.
Properties
EquationExpressions
A Collection of EquationExpression objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: EquationExpression
Remove
Returns: Boolean
Equation
An MWOffice Equation object.
Properties
Methods
None
Equations
A collection of MWOffice Equation objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Equation
Add2
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Equation
Remove
Returns: Boolean
Update
Returns: Boolean
GlobalDefinitionDocument
A MWOffice GlobalDefinitionDocument object.
Properties
Methods
Activate
Returns: Void
CopyToClipboard
Returns: Boolean
InvokeCommand
Description: Invoke a menu command by specifying the name for the command. Any required input will need to be
supplied as arguments.
Returns: Void
NewWindow
Returns: Window
Paste
Returns: Boolean
Syntax: Function Paste(x As Long, y As Long, [CCWRotation As Long = 0], [Flipped As Boolean = 0]) As Boolean
PrintOut
Returns: Boolean
StartCommand
Description: Start a menu command by specifying the name for the command. Any rquired input will need to be supplied
by the user interactively.
Returns: Void
GlobalDefinitionDocuments
A collection of GlobalDefinitionDocument objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: GlobalDefinitionDocument
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
OutputEquationDocument
A MWOffice OutputEquationDocument object.
Properties
Methods
Activate
Returns: Void
CopyToClipboard
Returns: Boolean
InvokeCommand
Description: Invoke a menu command by specifying the name for the command. Any required input will need to be
supplied as arguments.
Returns: Void
NewWindow
Returns: Window
Paste
Returns: Boolean
Syntax: Function Paste(x As Long, y As Long, [CCWRotation As Long = 0], [Flipped As Boolean = 0]) As Boolean
PrintOut
Returns: Boolean
StartCommand
Description: Start a menu command by specifying the name for the command. Any rquired input will need to be supplied
by the user interactively.
Returns: Void
OutputEquationDocuments
A collection of OutputEquationDocument objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: OutputEquationDocument
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
Goal
An MWOffice Goal object.
Properties
DisplayPrecision
A MWOffice DisplayPrecision object.
Properties
Graph
An MWOffice Graph object.
Properties
Methods
Activate
Returns: Void
ClearFrozenTraces
Returns: Void
CopyToClipboard
Returns: Void
CopyViewToClipboard
Returns: Boolean
ExportTraceData
Returns: Boolean
FreezeTraces
Returns: Void
GridToLogicalCoordinateX
Description: Converts a coordinate value from grid to logical coordinates along the X axis.
Returns: Long
GridToLogicalCoordinateY
Description: Converts a coordinate value from grid to logical coordinates along the Y axis.
Returns: Long
Syntax: Function GridToLogicalCoordinateY(GridY As Double, [yAxisIndex = 1], [OnLeft As Boolean = -1]) As Long
LogicalToGridCoordinateX
Description: Converts a coordinate value from logical to grid coordinates along the X axis.
Returns: Double
LogicalToGridCoordinateY
Description: Converts a coordinate value from logical to grid coordinates along the Y axis.
Returns: Double
NewWindow
Returns: Window
PrintOut
Returns: Void
SimulateMeasurements
Returns: Boolean
Graphs
A collection of MWOffice Graph objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Graph
Copy
Description: Copies an object from another object collection into this object collection.
Returns: Graph
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
Axis
An MWOffice Axis object.
Properties
Axes
A collection of MWOffice Axis objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Axes
Remove
Returns: Boolean
Trace
An MWOffice Trace object.
Properties
Traces
A collection of MWOffice Trace objects.
Properties
Legend
An MWOffice Legend object.
Properties
MarkerOptions
An MWOffice MarkerOptions Object.
Properties
MarkerDisplay
An MWOffice MarkerDisplay Object.
Properties
AutoSearchMarker
An MWOffice AutoSearchMarker Object.
Properties
OffsetMarker
An MWOffice OffsetMarker Object.
Properties
Marker
An MWOffice Marker object.
Properties
Methods
Delete
Returns: Boolean
MoveToMaximum
Returns: Boolean
MoveToMinimum
Returns: Boolean
Search
Returns: Boolean
Markers
A collection of MWOffice Marker objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Marker
AddEx
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Marker
Remove
Returns: Boolean
RemoveAll
Returns: Void
LineMarker
An MWOffice LineMarker object.
Properties
LineMarkers
A collection of MWOffice LineMarker objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LineMarker
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
Measurement
An MWOffice Measurement object.
Properties
Methods
ResizeFor2D
Returns: Void
ResizeFor2DEx
Description: Resizes a Measurement object for two dimensions and allows specification of the trace count.
Returns: Void
ResizeFor3D
Returns: Void
SimulateMeasurement
Returns: Boolean
Update
Returns: Void
Measurements
A collection of MWOffice Measurement objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Measurement
Remove
Returns: Void
RemoveAll
Returns: Void
Netlist
An MWOffice Netlist object.
Properties
Methods
Activate
Returns: Void
Export
Returns: Boolean
NewWindow
Returns: Window
Parse
Returns: Void
PrintOut
Returns: Void
Netlists
A collection of MWOffice Netlist objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Netlist
AddEx
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Netlist
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: Netlist
Syntax: Function Import(Name As String, Filename As String, Embedded As Boolean, Type As mwNetlistType) As
Netlist
LinkTo
Description: Adds a Netlist object link to the collection from a file and returns a reference to the created object.
Returns: Netlist
Remove
Returns: Boolean
Node
An MWOffice Node object.
Properties
Nodes
A collection of MWOffice Node objects.
Properties
OptGoals
A collection of MWOffice Goal objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Goal
Syntax: Function Add(CircuitName As String, MeasName As String, GoalType As mwOptGoalType, Weight As Double,
L As Long, xStart As Double, xStop As Double, xUnit As mwUnitType, yStart As Double, yStop As Double, yUnit As
mwUnitType) As Goal
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
Parameter
An MWOffice Parameter object.
Properties
Parameters
A collection of MWOffice Parameter objects.
Properties
ParameterDefinition
An MWOffice ParameterDefinition object.
Properties
ParameterDefinitions
A collection of MWOffice ParameterDefinition objects.
Properties
ParameterFrame
An MWOffice ParameterFrame object.
Properties
Methods
None
LayoutParameterFrame
An MWOffice LayoutParameterFrame object.
Properties
Methods
None
ProcessLibrary
An MWOffice ProcessLibrary object.
Properties
ProcessLibraries
A collection of MWOffice ProcessLibrary objects.
Properties
Methods
AddLibrary
Returns: Boolean
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
RemoveLibrary
Returns: Boolean
ProcessLibraryInfo
An MWOffice ProcessLibraryInfo object.
Properties
ProcessLibraryInfos
A collection of MWOffice ProcessLibraryInfo objects.
Properties
Property
An MWOffice Property object.
Properties
Properties
A collection of MWOffice Property objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Property
Exists
Description: Returns whether an item matching the specified criteria exists in the collection.
Returns: Boolean
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Void
Schematic
An MWOffice Schematic object.
Properties
Methods
Activate
Returns: Void
AddExtraction
Description: Add an exraction document associated with this schematic object. Values specified in extract block in the
schematic
Returns: Boolean
CopyToClipboard
Returns: Void
CopyViewToClipboard
Returns: Boolean
Export
Returns: Void
ExportNetlist
Returns: Void
InvokeCommand
Description: Invoke a menu command by specifying the name for the command. Arguments need to be supplied for
any input.
Returns: Void
LockDiagram
Description: Changes the lock level of the schematic diagram to the given lock level
Returns: Boolean
NewWindow
Returns: Window
Paste
Returns: Boolean
Syntax: Function Paste(x As Long, y As Long, [CCWRotation As Long = 0], [Flipped As Boolean = 0]) As Boolean
PrintOut
Returns: Void
PrintView
Returns: Boolean
SetupConnectivity
Returns: Void
StartCommand
Description: Start a menu command by specifying the name for the command, user wll need to complete interactive
input.
Returns: Void
UpdateConnectivity
Description: Sends notifications that the connectivity of this schematic document has changed and referring documents
need to update.
Returns: Void
Events
AfterRename
Returns: HRESULT
BeforeRemove
Returns: HRESULT
BeforeRename
Returns: HRESULT
Options
Schematics
A collection of MWOffice Schematic objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Schematic
Copy
Description: Copies an object from another object collection into this object collection.
Returns: Schematic
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: Schematic
LinkTo
Description: Adds a Schematic object link to the collection from a file and returns a reference to the created object.
Returns: Schematic
Remove
Returns: Boolean
Options
Subcircuits
A collection of MWOffice Element objects consisting of only the schematic subcircuits
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Element
Syntax: Function Add(SubcircuitName As String, x As Long, y As Long, [RotationAngle As Long = 0], [Flipped As
Boolean = 0], [Symbol As String = ""], [GndType As mwSubcktGroundType = 0]) As Element
Remove
Returns: Boolean
Subsystems
A collection of MWOffice Element objects consisting of only the system diagram subsystems.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: HRESULT
Syntax: Function Add(SubSystemName As String, x As Long, y As Long, [RotationAngle As Long = 0], [Flipped As
Boolean = 0], [Symbol As String = ""], [GndType As mwSubcktGroundType = 0]) As Element
Remove
Returns: HRESULT
Ports
A collection of MWOffice Element objects consisting of only the schematic or system diagram ports
Properties
ElectricalNets
A collection of MWOffice Element objects consisting of only the schematic electrical nets
Properties
NamedConnectors
A collection of MWOffice Element objects consisting of only the schematic named connectors
Properties
SymbolNode
An MWOffice SymbolNode object.
Properties
SymbolNodes
A collection of MWOffice SymbolNode objects.
Properties
SymbolShape
An MWOffice SymbolShape object.
Properties
SymbolShapes
A collection of MWOffice SymbolShape objects.
Properties
SymbolRecord
An MWOffice SymbolRecord object.
Properties
Methods
AddArc
Returns: SymbolShape
Syntax: Function AddArc(Left As Long, Top As Long, Right As Long, Bottom As Long, xStart As Long, yStart As
Long, xEnd As Long, yEnd As Long) As SymbolShape
AddEllipse
Returns: SymbolShape
Syntax: Function AddEllipse(Left As Long, Top As Long, Right As Long, Bottom As Long) As SymbolShape
AddLine
Returns: SymbolShape
AddMetaText
Returns: SymbolShape
Syntax: Function AddMetaText(Left As Long, Top As Long, Right As Long, Bottom As Long, Text As String) As
SymbolShape
AddNode
Returns: SymbolNode
Syntax: Function AddNode(x As Long, y As Long, TextDx As Long, TextDy As Long, TextVisible As Boolean) As
SymbolNode
AddNode2
Description: Adds a symbol connection node with label text to the SymbolRecord object.
Returns: SymbolNode
Syntax: Function AddNode2(x As Long, y As Long, Text As String, TextDx As Long, TextDy As Long, TextVisible
As Boolean) As SymbolNode
AddPolygon
Returns: SymbolShape
AddPolyline
Returns: SymbolShape
AddText
Returns: SymbolShape
Syntax: Function AddText(Left As Long, Top As Long, Right As Long, Bottom As Long, Text As String) As
SymbolShape
AddText2
Returns: SymbolShape
Syntax: Function AddText2(Left As Long, Top As Long, Height As Long, CCWRotation As Long, Text As String) As
SymbolShape
Symbol
An MWOffice Symbol object.
Properties
Methods
None
Symbols
A collection of MWOffice Symbol objects.
Properties
Methods
CreateSymbol
Returns: Symbol
CreateSymbolRecord
Returns: SymbolRecord
Export
Returns: Boolean
GetDefaultSymbol
Returns: Symbol
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: Boolean
ImportSystemFile
Description: Imports a symbol file into the system symbols collection. These symbols are not saved with the project.
Returns: Boolean
Remove
Returns: Boolean
SaveToFile
Returns: Void
Unit
An MWOffice Unit object.
Properties
Units
A collection of MWOffice Unit objects.
Properties
SweepValue
A MWOffice SweepVariable object.
Properties
SweepValues
A collection of MWOffice SweepValue objects.
Properties
SweepVariable
A MWOffice SweepVariable object.
Properties
SweepVariables
A collection of MWOffice SweepVariable objects.
Properties
Window
An MWOffice Window object.
Properties
Methods
Activate
Returns: Void
Center
Description: Centers the window in the MDI child region of the main frame window if applicable.
Returns: Boolean
Close
Returns: Void
ViewAll
Returns: Void
Windows
A collection of MWOffice Window objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Window
Cascade
Returns: Void
Tile
Returns: Void
WireNet
An MWOffice WireNet object.
Properties
Methods
None
WireSegment
An MWOffice WireSegment object.
Properties
Methods
AddBusNetName
Description: Adds a BusNetName object to the WiresegmentObject and returns a reference to the newly added
BusNetName object.
Returns: BusNetName
Syntax: Function AddBusNetName(Name As String, x As Long, y As Long, [Priority As Long = 0], [Flags As Long =
0]) As BusNetName
Delete
Returns: Boolean
RemoveBusNetName
Returns: Boolean
Wires
A collection of MWOffice WireSegment objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: WireSegment
AddBusNet
Description: Adds an object to the collection and returns a reference to the created object.
Returns: WireSegment
Syntax: Function AddBusNet(x1 As Long, y1 As Long, x2 As Long, y2 As Long, NetName As String, xName As Long,
yName As Long, [Priority As Long = 0], [Flags As Long = 0]) As WireSegment
Cleanup
Returns: Boolean
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
SelectedWires
A collection of MWOffice SelectedWire objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
AddAll
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
YieldGoals
A collection of MWOffice Goal objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Goal
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
Option
An MWOffice Option object.
Properties
Options
A collection of MWOffice Option objects.
Properties
SystemDiagram
An MWOffice SystemDiagram object.
Properties
Methods
Activate
Returns: Void
CopyToClipboard
Returns: Void
CopyViewToClipboard
Returns: Boolean
Export
Returns: Void
InvokeCommand
Description: Invoke a menu command by specifying the name for the command. Arguments must be supplied for any
required input.
Returns: Void
LockDiagram
Description: Changes the lock level of the system diagram to the given lock level
Returns: Boolean
NewWindow
Returns: Window
Paste
Returns: Boolean
Syntax: Function Paste(x As Long, y As Long, [CCWRotation As Long = 0], [Flipped As Boolean = 0]) As Boolean
PrintOut
Returns: Void
PrintView
Returns: Boolean
SetupConnectivity
Returns: Void
StartCommand
Description: Start a menu command by specifying the name for the command. The user will need to complete any
required input.
Returns: Void
Options
SystemDiagrams
A collection of MWOffice SystemDiagram objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: SystemDiagram
Copy
Description: Copies an object from another object collection into this object collection.
Returns: SystemDiagram
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: SystemDiagram
LinkTo
Description: Adds a SystemDiagram object link to the collection from a file and returns a reference to the created object.
Returns: SystemDiagram
Remove
Returns: Boolean
Options
DesignNote
An MWOffice DesignNote object.
Properties
Methods
Activate
Returns: Void
CopyToClipboard
Returns: Void
Export
Returns: Void
Import
Returns: Void
NewWindow
Returns: Window
Paste
Description: Pastes the current contents of the clipboard into the design note view.
Returns: Boolean
PrintOut
Returns: Void
DesignNotes
A collection of MWOffice DesignNote objects.
Properties
Simulator
An MWOffice Simulator object.
Properties
Methods
Analyze
Returns: Void
AnalyzeOpenGraphs
Returns: Void
Continue
Returns: Void
Pause
Returns: Void
RunStop
Description: Runs the system simulators if they are stopped, stops the system simulators if they are running
Returns: Void
Start
Returns: Void
Stop
Returns: Void
Attribute
An MWOffice Attribute object.
Properties
Attributes
A collection of MWOffice Attribute objects.
Properties
BoundaryModel
An MWOffice BoundaryModel object.
Properties
Boundary
An MWOffice Boundary object.
Properties
LayoutParameter
An MWOffice LayoutParameter object.
Properties
LayoutParameters
A collection of MWOffice LayoutParameters objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LayoutParameter
Syntax: Function Add(Name As String, Value As Double, [UnitType As mwUnitType = 17]) As LayoutParameter
AddInteger
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LayoutParameter
AddString
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LayoutParameter
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
ObjectName
An MWOffice ObjectName Object.
Properties
ObjectNames
A collection of MOffice ObjectName objects.
Properties
ComplexNumber
A MWOffice ComplexNumber object.
Properties
ComplexNumbers
A collection of MWOffice ComplexNumber objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ComplexNumber
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
Offset
An MWOffice Offset object.
Properties
Offsets
A collection of MWOffice Offset objects.
Properties
Point
An MWOffice Point object.
Properties
Points
A collection of MWOffice Point objects.
Properties
Size
An MWOffice Size object.
Properties
Sizes
A collection of MWOffice Size objects.
Properties
Vertex
An MWOffice Vertex object.
Properties
Vertices
A collection of MWOffice Vertex objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Vertex
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
Vertex3D
An MWOffice Vertex3D object.
Properties
CellInstance
An MWOffice CellInstance object.
Properties
Methods
None
CellInstances
A collection of MWOffice CellInstance objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: CellInstance
Remove
Returns: Boolean
Cell
An MWOffice Cell object.
Properties
Methods
Activate
Returns: Void
EditCell
Returns: CellEditor
Export
Returns: Boolean
Syntax: Function Export(Filename As String, format As mwCellExportFormat, [bFlat As Boolean = 0]) As Boolean
NewWindow
Returns: Window
UpdateViews
Description: Updates active views associated with the given cell object to display the latest shape edits.
Returns: Boolean
Cells
A collection of MWOffice Cell objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Cell
Copy
Description: Copies an object from another object collection into this object collection.
Returns: Cell
Syntax: Function Copy(FromLibrary As String, FromCell As String, [NewCellName As String = ""], [FlattenCell As
Boolean = 0]) As Cell
Copy2
Description: Copies an object from another object collection into this object collection.
Returns: Cell
Syntax: Function Copy2(FromLibrary As String, FromCell As String, [NewCellName As String = ""], [FlattenCell As
Boolean = 0], [CopyChildren As Boolean = 0]) As Cell
Remove
Returns: Boolean
CellLibrary
An MWOffice Cell Library object.
Properties
Methods
Merge
Description: Merges the named library with this library to form a single library
Returns: Boolean
SaveAs
Returns: Void
CellLibraries
A collection of MWOffice Cell Library objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: CellLibrary
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: CellLibrary
Import2
Description: Adds a CellLibrary object to the collection from a file and returns a reference to the created object.
Returns: CellLibrary
LinkTo
Description: Adds a CellLibrary object to the collection linked the library file and returns a reference to the created
object.
Returns: CellLibrary
Remove
Returns: Boolean
EMLayerMapEntry
An MWOffice EMLayerMapEntry object.
Properties
EMLayerMapEntries
A collection of MWOffice EMLayerMapEntry objects.
Properties
EMLayerMapping
An MWOffice EMLayerMapping object.
Properties
EMLayerMappings
A collection of MWOffice EMLayerMapping objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: EMLayerMapping
Copy
Returns: EMLayerMapping
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
SetActive
Description: Sets the mapping identified by index active to be the active EM mapping.
Returns: Void
LayerMapEntry
An MWOffice LayerMapEntry object.
Properties
LayerMapEntries
A collection of MWOffice LayerMapEntry objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LayerMapEntry
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
LayerMapping
An MWOffice LayerMapping object.
Properties
LayerMappings
A collection of MWOffice LayerMapping objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LayerMapping
Clear
Returns: Boolean
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
LayerExportEntry
An MWOffice LayerExportEntry object.
Properties
LayerExportEntries
A collection of MWOffice LayerExportEntry objects.
Properties
LayerExportMapping
An MWOffice LayerExportMapping object.
Properties
LayerExportMappings
A collection of MWOffice LayerExportMapping objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LayerExportMapping
Clear
Returns: Boolean
Copy
Returns: LayerExportMapping
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
DrawingLayer
An MWOffice Drawing Layer object.
Properties
DrawingLayers
A collection of MWOffice Drawing Layer objects.
Properties
Methods
Add2
Description: Adds an object to the collection and returns a reference to the created object.
Returns: DrawingLayer
Syntax: Function Add2(Name As String, [LineColor As Long = 255], [LineStyle As mwLineStyle = 0], [Filled As
Boolean = -1], [FillColor As Long = 255], [FillStyle As mwFillStyle = 1], [Thickness As Double = 0], [ZPosition As
Double = 0], [Opaque2D As Boolean = -1], [Opaque3D As Boolean = -1], [Blend2D As Double = 0], [Blend3D As
Double = 0]) As DrawingLayer
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
LayerSetup
An MWOffice LayerSetup object.
Properties
Methods
None
DrillTool
An MWOffice DrillTool object.
Properties
DrillTools
A collection of MWOffice DrillTool objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: DrillTool
Syntax: Function Add(Name As String, [Number As Int = 1], [Radius As Double = 9.99999974737875E-05]) As
DrillTool
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
ModifierDefDrawingObjects
A collection of DrawingObject objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
ModifierDefRecord
A MWOffice ModifierDefRecord object.
Properties
ModifierDefRecords
A collection of ModifierDefRecord objects.
Properties
ShapeModifierRecord
A MWOffice ShapeModifierRecord object.
Properties
ShapeModifierRecords
A collection of MWOffice ShapeModfierRecordObjects.
Properties
ShapeModifier
A MWOffice ShapeModifier object.
Properties
ShapeModifiers
A collection of MWOffice ShapeModifier objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ShapeModifier
CreateModifierDefRecord
Description: Creates and returns a shape modifier record for creating a specific type of shape modifier.
Returns: ModifierDefRecord
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
DesignRule
An MWOffice DesignRule object.
Properties
DesignRules
A collection of MWOffice DesignRule objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: DesignRule
AddGroup
Description: Adds an object to the collection and returns a reference to the created object.
Returns: DesignRule
Export
Returns: Boolean
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: Boolean
ImportDefaultRules
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: Boolean
Remove
Returns: Boolean
RemoveAll
Returns: Void
DesignRuleError
An MWOffice DesignRuleError object.
Properties
DesignRuleErrors
A collection of MWOffice DesignRuleError objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: DesignRuleError
Load
Description: Reads in the specified DRC error file and adds the errors to the DesignRuleErrors collection (does not clear
errors first.)
Returns: Void
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
Save
Description: Saves the errors in the DesignRuleErrors collection to the specified file name in AWR DRC error format.
Returns: Void
LVSError
An MWOffice LVSError object.
Properties
LVSErrors
A collection of MWOffice LVSError objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LVSError
Load
Description: Reads in the specified LVS error file and adds the errors to the LVSErrors collection (does not clear errors
first.)
Returns: Void
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
Save
Description: Saves the errors in the LVSErrors collection to the specified file name in AWR error format.
Returns: Void
LVSSchemHighlight
An MWOffice SchematicHighlight object.
Properties
LVSSchemHighlights
A collection of MWOffice SchematicHighlights objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LVSSchemHighlight
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
LVSNetHighlight
An MWOffice NetlistHighlight object.
Properties
LVSNetHighlights
A collection of MWOffice NetlistHighlight objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LVSNetHighlight
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
DesignRuleChecker
An MWOffice DesignRuleChecker object.
Properties
Methods
CompareLayoutToGDSFile
Description: Compares the layout associated with this design rule checkout with a specified GDSII file.
Returns: Boolean
CreateRuleSet
Returns: DesignRules
RunCheck
Description: Runs a design rule check on the layout associated with the design rule checker
Returns: Boolean
LayoutVsSchematicChecker
An MWOffice LayoutVsSchematicChecker object.
Properties
Methods
None
DRCErrorsWindow
An MWOffice DRCErrorsWindow object.
Properties
LVSErrorsWindow
An MWOffice DRCErrorsWindow object.
Properties
DRCErrorShape
An MWOffice DRCErrorShape object, for use with DRC/LVS error types that have multiple shapes (like
mwDRT_MultiPolygon)
Properties
DRCErrorShapes
A collection of MWOffice DRCErrorShape objects.
Properties
Methods
AddPolygon
Returns: DRCErrorShape
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
ConnectivityHighlighter
An MWOffice ConnectivityHighlighter object.
Methods
HighlightAll
Description: Turns on highlight for all connectivity in the assoicated layout design.
Returns: Boolean
HighlightOff
Description: Turns off highlight for all connectivity in the associated layout design.
Returns: Boolean
HighlightProbe
Description: Turns on highlight for connectivity for shapes associated with a specific probe location in the associated
layout design.
Returns: Boolean
HighlightSelectedOff
Description: Turns off highlight for connectivity for selected shapes in the associated layout design.
Returns: Boolean
HighlightShape
Description: Turns on highlight for connectivity associated with the given DrawingObject in the associated layout
design.
Returns: Boolean
DrawingObject
An MWOffice DrawingObject.
Properties
Methods
Copy
Description: Create a copy of the drawing object located at the specified x and y location.
Returns: Boolean
Delete
Returns: Boolean
Flatten
Description: Flattens the drawing object into a collection of shapes returns a reference to the resulting shapes in the
design.
Returns: Shapes
Move
Description: Moves the DrawingObject by the given values relative to the current location.
Returns: Boolean
Syntax: Function Move(dx As Double, dy As Double, [CCWRotation As Double = 0], [Flip As Boolean = 0],
[FlipHorizontal As Boolean = 0], [xOrigin As Double = 0], [yOrigin As Double = 0]) As Boolean
ResizeObject
Description: Updates the size and position of the drawing object within the layout.
Returns: Void
DrawingObjects
A collection of MWOffice DrawingObjects.
Properties
Methods
AddArc
Returns: DrawingObject
Syntax: Function AddArc(xCenter As Double, yCenter As Double, Radius As Double, StartAngle As Double, EndAngle
As Double, [LayerName As String = ""], [UseProcessLayers As Boolean = 0], [LayerMapping As String = ""]) As
DrawingObject
AddArrayCell
Returns: DrawingObject
AddCell
Returns: DrawingObject
AddDimensionLine
Returns: DrawingObject
AddDrillHole
Returns: DrawingObject
AddEllipse
Returns: DrawingObject
Syntax: Function AddEllipse(x As Double, y As Double, dx As Double, dy As Double, [LayerName As String = ""],
[UseProcessLayers As Boolean = 0], [LayerMapping As String = ""]) As DrawingObject
AddLayoutCell
Returns: DrawingObject
Syntax: Function AddLayoutCell(Name As String, x As Double, y As Double, [RotationAngle As Double = 0], [Flipped
As Boolean = 0]) As DrawingObject
AddLayoutRuler
Returns: DrawingObject
AddPath
Returns: DrawingObject
Syntax: Function AddPath(XYPoints As SafeArray, Width As Double, [EndStyle As mwPathEndType = 1], [MiterStyle
As mwPathMiterType = 1], [OffsetMiterAmount As Double = 0], [LayerName As String = ""], [UseProcessLayers As
Boolean = 0], [LayerMapping As String = ""]) As DrawingObject
AddPathEx
Returns: DrawingObject
Syntax: Function AddPathEx(XYPoints As SafeArray, Width As Double, [EndStyle As mwPathEndType = 1], [MiterStyle
As mwPathMiterType = 1], [OffsetMiterAmount As Double = 0], [PathBeginExtent As Double = 0], [PathEndExtent
As Double = 0], [LayerName As String = ""], [UseProcessLayers As Boolean = 0], [LayerMapping As String = ""]) As
DrawingObject
AddPolygon
Returns: DrawingObject
AddRectangle
Returns: DrawingObject
Syntax: Function AddRectangle(x As Double, y As Double, dx As Double, dy As Double, [LayerName As String = ""],
[UseProcessLayers As Boolean = 0], [LayerMapping As String = ""]) As DrawingObject
AddRoute
Returns: DrawingObject
AddText
Returns: DrawingObject
Syntax: Function AddText(x As Double, y As Double, Height As Double, Text As String, [RotationAngle As Double
= 0], [Flipped As Boolean = 0], [FontName As String = ""], [Bold As Boolean = 0], [Italic As Boolean = 0],
[DrawAsPolygons As Boolean = -1], [LayerName As String = ""], [UseProcessLayers As Boolean = 0], [LayerMapping
As String = ""]) As DrawingObject
AddTextEx
Returns: DrawingObject
Syntax: Function AddTextEx(x As Double, y As Double, Height As Double, Text As String, [DrawAsPolygons As
Boolean = -1], [LayerName As String = ""], [TextAlignment As mwTextAlignment = 5], [RotationAngle As Double =
0], [Flipped As Boolean = 0], [FontName As String = ""], [Bold As Boolean = 0], [Italic As Boolean = 0],
[UseProcessLayers As Boolean = 0], [LayerMapping As String = ""]) As DrawingObject
CreateRouteRecord
Returns: RouteRecord
NegateLayer
Description: Process layer shapes to invert complex polygons and subtract them from remaining layer shapes.
Returns: Boolean
NegateLayerShapes
Description: Process layer shapes to invert shapes marked as negative and subtract them from remaining layer shapes.
Returns: Boolean
PolygonRecord
An MWOffice PolygonRecord object.
Properties
Methods
AddCircle
Description: Add a circle shaped polygon to the record object with the given center and radius values
Returns: Void
AddCircleCutout
Returns: Void
AddEllipse
Description: Add an ellipse shaped polygon to the record object with the given upper left corner and width and height
Returns: Void
AddEllipseCutout
Returns: Void
AddPolyArcSegment
Description: Adds a new arc segment to the current polygon or cutout polygon ot the PolygonRecord object.
Returns: Void
Syntax: Sub AddPolyArcSegment(x2 As Double, y2 As Double, centerX As Double, centerY As Double, dir As
mwDrawingArcDirection)
AddPolySegment
Description: Adds a new segment to the current polygon or cutout polygon to the PolygonRecord object.
Returns: Void
Clear
Returns: Void
HasCutouts
Returns: Boolean
Mirror
Description: Mirrors the object represented by the PolygonRecord object about the y-axis.
Returns: Void
Offset
Returns: Void
PolyCutoutBegin
Description: Method to indicate the start of a polygon cutout object to the PolygonRecord object.
Returns: Void
PolyCutoutEnd
Description: Method to indicate the end of a polygon cutout object to the PolygonRecord object.
Returns: Void
PolygonBegin
Description: Method to indicate the start of a new polygon object to the PolygonRecord object.
Returns: Void
PolygonEnd
Description: Method to indcate the end of the polygon object to the PolygonRecord object.
Returns: Void
Rotate
Description: Adds a counter-clockwise rotation to the object represented by the PolygonRecord object.
Returns: Void
Scale
Description: Adds a scale factor to the object repersented by the PolygonRecord object.
Returns: Void
PolygonWriter
An MWOffice PolygonWriter object.
Properties
Methods
AddPolygon
Description: Adds a new polygon to the PolygonWriter target design using the information specified in the PolygonRecord
object.
Returns: DrawingObject
CachePolygon
Description: Add the polygon shape information to a named set of shapes to be created later.
Returns: Void
CreateCachedPolygons
Description: Add the polygon shapes from the named collection to the design with the given transform values.
Returns: Void
Syntax: Sub CreateCachedPolygons(Name As String, [offsetDx As Double = 0], [offsetDy As Double = 0], [rotCCW
As Double = 0], [rotAboutX As Double = 0], [rotAboutY As Double = 0], [Mirror As Boolean = 0], [mirrorAboutX As
Double = 0], [Scale As Double = 1], [scaleAboutX As Double = 0], [scaleAboutY As Double = 0])
CreatePolygonRecord
Returns: PolygonRecord
PathRecord
An MWOffice PathRecord object.
Properties
Methods
AddArcSegment
Description: Adds a new arc segment to the current path object in the PathRecord object.
Returns: Void
AddSegment
Description: Adds a new segment to the current path object to in the PathRecord object.
Returns: Void
Clear
Returns: Void
Mirror
Description: Mirrors the object represented by the PathRecord object about the y-axis.
Returns: Void
Offset
Returns: Void
PathBegin
Description: Method to indicate the start of a new path object to the PathRecord object.
Returns: Void
PathEnd
Description: Method to indicate the ned of the path object to the PathRecord object.
Returns: Void
Rotate
Description: Adds a counter-clockwise rotation to the object represented by the PathRecord object.
Returns: Void
Scale
Description: Adds a scale factor to the object repersented by the PathRecord object.
Returns: Void
PathWriter
An MWOffice PathWriter object.
Properties
Methods
AddPath
Description: Adds a new path to the PathWriter target desing using the information specified in the PathRecord object.
Returns: DrawingObject
CachePath
Description: Add the path shape information to a named set of shapes to be created later.
Returns: Void
CreateCachedPaths
Description: Add the path shapes from the named collection to the design with the given transform values.
Returns: Void
Syntax: Sub CreateCachedPaths(Name As String, [offsetDx As Double = 0], [offsetDy As Double = 0], [rotCCW As
Double = 0], [rotAboutX As Double = 0], [rotAboutY As Double = 0], [Mirror As Boolean = 0], [mirrorAboutX As
Double = 0], [Scale As Double = 1])
CreatePathRecord
Returns: PathRecord
SelectedDrawingObjects
A collection of MWOffice SelectedDrawingObject objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
AddAll
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
AddFromArea
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
Syntax: Function AddFromArea(Left As Double, Top As Double, Right As Double, Bottom As Double, [Type As
mwAreaAddType = 0]) As Boolean
AddFromRegion
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
AddOverlapped
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
GroupDrawingObjects
A collection of MWOffice GroupDrawingObject objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
Remove
Returns: Boolean
EMStructureInfo
An MWOffice EMStructure Info object.
Properties
EMInitializationRecord
A MWOffice EMInitializationRecord object.
Properties
EMStructure
An MWOffice EMStructure object.
Properties
Methods
Activate
Returns: Void
CopyToClipboard
Returns: Boolean
CopyToClipboardEx
Returns: Boolean
CopyViewToClipboard
Returns: Boolean
CreateMesh
Description: Generates a mesh for the current EMStructure. A mesh Annotation must be enabled to view the mesh.
Returns: Void
Export
Returns: Void
ExportEmInputData
Description: Exports the EMStructure EM Socket input data file to the specified filename.
Returns: Void
ExportEmInputDataXML
Description: Exports the EMStructure EM Socket input data file to the specified filename in XML format.
Returns: Boolean
ForceResimulate
Description: Marks the EMStructure as changed and clears existing results for resimulation.
Returns: Boolean
InvokeCommand
Description: Invoke a menu command by specifying the name for the command. Arguments must be suppled for any
required input.
Returns: Void
LockDiagram
Description: Changes the lock level of the EMStructure object to the given lock level
Returns: Boolean
NewWindow
Returns: Window
Paste
Returns: Boolean
Syntax: Function Paste(x As Double, y As Double, [CCWRotation As Double = 0], [Flipped As Boolean = 0]) As
Boolean
PasteRelative
Returns: Boolean
Syntax: Function PasteRelative(dx As Double, dy As Double, [CCWRotation As Double = 0], [Flipped As Boolean =
0]) As Boolean
PrintOut
Returns: Void
PrintOutEx
Returns: Boolean
PrintView
Returns: Boolean
Simulate
Returns: Boolean
SimulationLogClear
Returns: Void
StartCommand
Description: Start a menu command by specifying the name for the command. The user will need to complete any
required input.
Returns: Void
Update
Returns: Void
EMStructures
A collection of MWOffice EMStructure objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: EMStructure
AddEx
Description: Adds an object to the collection and returns a reference to the created object.
Returns: EMStructure
AddInit
Description: Adds an object to the collection and returns a reference to the created object.
Returns: EMStructure
Copy
Description: Copies an object from another object collection into this object collection.
Returns: EMStructure
CreateInitRecord
Returns: EMInitializationRecord
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: EMStructure
LinkTo
Description: Adds an Electromagnetic structure referencing an external file and returns a reference to the created object.
Returns: EMStructure
Remove
Returns: Boolean
ExternalEditor
A MWOffice ExternalEditor object.
Properties
Methods
Close
Returns: Boolean
RunScript
Returns: Boolean
Save
Returns: Boolean
Show
Returns: Boolean
Update
Returns: Boolean
EM3DStructure
A MWOffice EM3DStructure object.
Properties
Methods
Activate
Description: Brings any existing active window on the EM3DStructure object to the forground.
Returns: Void
CopyToClipboard
Returns: Boolean
CopyViewToClipboard
Returns: Boolean
Export
Returns: Boolean
NewWindow
Returns: Window
OpenExternalEditor
Returns: ExternalEditor
PrintOut
Returns: Boolean
PrintView
Returns: Boolean
Simulate
Returns: Boolean
Update
Description: Update the structure to refresh any changes made by external editors.
Returns: Void
EM3DStructures
A collection of EM3DStructure objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: EM3DStructure
AddLinked
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Void
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: EM3DStructure
LinkTo
Description: Adds an Electromagnetic structure referencing an external file and returns a reference to the created object.
Returns: EM3DStructure
Remove
Returns: Boolean
Face
An MWOffice Face object.
Properties
Faces
A collection of MWOffice Face objects.
Properties
Layout
An MWOffice Layout object.
Properties
Methods
Activate
Returns: Void
CopyToClipboard
Returns: Void
CopyToClipboardEx
Returns: Boolean
CopyViewToClipboard
Returns: Boolean
CreateCell
Returns: Cell
CreateSnapshot
Returns: Snapshot
Export
Returns: Boolean
InvokeCommand
Description: Invoke a menu command by specifying the name for the command. Arguments must be supplied for all
required input.
Returns: Void
NewWindow
Returns: Window
Paste
Returns: Boolean
Syntax: Function Paste(x As Double, y As Double, [CCWRotation As Double = 0], [Flipped As Boolean = 0]) As
Boolean
PasteRelative
Returns: Boolean
Syntax: Function PasteRelative(dx As Double, dy As Double, [CCWRotation As Double = 0], [Flipped As Boolean =
0]) As Boolean
PrintOut
Returns: Void
PrintOutEx
Returns: Boolean
PrintView
Returns: Boolean
Refresh
Returns: Void
RegenerateLayout
Description: Deletes and regenerates all the cell objects in layout, may cause objects to shift in position.
Returns: Boolean
SnapTogether
Returns: Void
StartCommand
Description: Start a menu command by specifying the name for the command. The user will need to complete any
required input.
Returns: Void
Update
Returns: Void
Options
CellEditor
An MWOffice CellEditor object.
Properties
Methods
Activate
Returns: Void
CopyToClipboard
Returns: Void
CopyToClipboardEx
Returns: Boolean
CopyViewToClipboard
Returns: Boolean
CreateCell
Returns: Cell
CreateSnapshot
Returns: Snapshot
Export
Returns: Boolean
InvokeCommand
Description: Invoke a menu command by specifying the name for the command. Any required input will need to be
supplied in arguments.
Returns: Void
NewWindow
Returns: Window
Paste
Returns: Boolean
Syntax: Function Paste(x As Double, y As Double, [CCWRotation As Double = 0], [Flipped As Boolean = 0]) As
Boolean
PasteRelative
Returns: Boolean
Syntax: Function PasteRelative(dx As Double, dy As Double, [CCWRotation As Double = 0], [Flipped As Boolean =
0]) As Boolean
PrintOut
Returns: Void
Refresh
Returns: Void
SaveCell
Returns: Boolean
StartCommand
Description: Start a menu command by specifying the name for the command. Any required input will need to be
supplied by the user interactively.
Returns: Void
Update
Returns: Void
CellEditors
A collection of MWOffice CellEditor objects.
Properties
Enclosure
An MWOffice Enclosure object.
Properties
MaterialLayer
An MWOffice Material Layer object.
Properties
MaterialLayers
A collection of MWOffice Material Layer objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: MaterialLayer
Syntax: Function Add([Layer As Int = 1], [Hatch As mwHatchStyle = 5], [ViaHatch As mwHatchStyle = 4], [Thickness
As Double = 9.99999974737875E-05], [DielectricConstant As Double = 1], [LossTangent As Double = 0],
[BulkConductivity As Double = 0], [ViewScale As Double = 1]) As MaterialLayer
Remove
Returns: Boolean
ShapeSubObject
An MWOffice ShapeSubObject object.
Properties
ShapeSubObjects
A collection of MWOffice ShapeSubObject objects.
Properties
ShapeSegment
An MWOffice ShapeSegment object.
Properties
ShapeSegments
A collection of MWOffice ShapeSegment objects.
Properties
ShapeArcSegment
An MWOffice ShapeArcSegment object.
Properties
ShapeArcSegments
A collection of MWOffice ShapeArcSegment objects.
Properties
Shape
An MWOffice Shape object.
Properties
Shapes
A collection of MWOffice Shape objects.
Properties
Methods
AddArc
Returns: Shape
Syntax: Function AddArc(xCenter As Double, yCenter As Double, Radius As Double, StartAngle As Double, EndAngle
As Double, [LayerName As String = ""]) As Shape
AddDrillHole
Returns: Shape
AddEllipse
Returns: Shape
Syntax: Function AddEllipse(x As Double, y As Double, dx As Double, dy As Double, [LayerName As String = ""])
As Shape
AddFace
Description: Adds a cell face shape to the Shapes collection. Connect values are from mwPortFaceConnectTypes enum.
Returns: Shape
Syntax: Function AddFace(x1 As Double, y1 As Double, x2 As Double, y2 As Double, [PortNumber As Int = 0],
[ConnectType As Int = 0]) As Shape
AddFaceEx
Description: Adds a cell face shape to the Shapes collection. Connect values are from mwPortFaceConnectTypes enum.
Returns: Shape
Syntax: Function AddFaceEx(x1 As Double, y1 As Double, x2 As Double, y2 As Double, [PortNumber As Int = 0],
[ConnectType As Int = 0], [LayerName As String = ""]) As Shape
AddPath
Returns: Shape
Syntax: Function AddPath(XYPoints As SafeArray, Width As Double, [LayerName As String = ""], [EndStyle As
mwPathEndType = 1], [MiterStyle As mwPathMiterType = 1], [OffsetMiterAmount As Double = 0]) As Shape
AddPin
Description: Adds a pin shape to the shapes collection. Connect values are from mwPortFaceConnectTypes enum.
Returns: Shape
Syntax: Function AddPin(XYPoints As SafeArray, [LayerName As String = ""], [PortNumber As Int = 0], [ConnectType
As Int = 0]) As Shape
AddPolygon
Returns: Shape
AddRectangle
Returns: Shape
Syntax: Function AddRectangle(x As Double, y As Double, dx As Double, dy As Double, [LayerName As String = ""])
As Shape
AddText
Returns: Shape
Syntax: Function AddText(x As Double, y As Double, Height As Double, Text As String, [LayerName As String = ""],
[RotationAngle As Double = 0], [FontName As String = ""], [Bold As Boolean = 0], [Italic As Boolean = 0],
[DrawAsPolygons As Boolean = -1]) As Shape
AddTextEx
Returns: Shape
Syntax: Function AddTextEx(x As Double, y As Double, Height As Double, Text As String, [DrawAsPolygons As
Boolean = -1], [LayerName As String = ""], [TextAlignment As mwTextAlignment = 5], [RotationAngle As Double =
0], [FontName As String = ""], [Bold As Boolean = 0], [Italic As Boolean = 0]) As Shape
AddVia
Description: Adds a via shape to the Shapes collection. If the via should be a port the optional bPort is true.
Returns: Shape
Syntax: Function AddVia(x As Double, y As Double, dx As Double, dy As Double, [LayerName As String = ""], [IsPort
As Boolean = 0]) As Shape
DrawingSubObject
An MWOffice DrawingSubObject object.
Properties
Methods
Delete
Returns: Boolean
Move
Returns: Boolean
DrawingSubObjects
A collection of MWOffice DrawingSubObject objects.
Properties
Methods
AddCircle
Returns: DrawingSubObject
AddEllipse
Returns: DrawingSubObject
AddPolygon
Returns: DrawingSubObject
AddRectangle
Returns: DrawingSubObject
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
DrawingSegment
An MWOffice DrawingSegment object.
Properties
Methods
MakeArcSegment
Description: Makes the segment into an arc segment with a specific center point and direction.
Returns: DrawingArcSegment
RevertArcSegment
Description: Reverts the segment from an arc segment into a normal straight segment.
Returns: Boolean
DrawingSegments
A collection of MWOffice DrawingSegment objects.
Properties
DrawingArcSegment
An MWOffice DrawingArcSegment object.
Properties
DrawingArcSegments
A collection of DrawingArcSegment objects.
Properties
Snapshot
An MWOffice Snapshot object.
Properties
Methods
CopyLayerToCellEditor
Description: Copies the shapes on the specified layer of this snapshot to the given cell editor.
Returns: Boolean
CopyLayerToLayout
Description: Copies the shapes on the specified layer of this snapshot to the given layout.
Returns: Boolean
CopyLayerToSnapshot
Description: Copies the shapes on the specified layer of this snapshot to the given Snapshot.
Returns: Boolean
CopyShapesToLayer
Description: Copies all the shapes from a source layer and adds them to a destination layer in the snapshot.
Returns: Boolean
CopyToCellEditor
Description: Copies the shapes of this snapshot to the given cell editor.
Returns: Boolean
CopyToLayout
Returns: Boolean
CopyToSnapshot
Returns: Boolean
DeleteLayerShapes
Returns: Boolean
ExclusiveOrLayersEx
Description: Process the shapes on the given source layers to produce the exclusive or of overlapping shapes in the
snapshot.
Returns: Boolean
ExclusiveOrShapes
Description: Process the shapes of this snapshot produce the exclusive or of overalapped shapes.
Returns: Boolean
Export
Returns: Boolean
Syntax: Function Export(Filename As String, ExportMap, [LibraryName As String = ""], [CellName As String = ""],
[Flat As Boolean = 0]) As Boolean
IntersectLayersEx
Description: Process the shapes on the given source layers to produce the intersection of overlapping shapes in the
snapshot.
Returns: Boolean
IntersectShapes
Description: Process the shapes of this snapshot to produce the intersecton of overlapped shapes.
Returns: Boolean
MoveShapesToLayer
Description: Moves all the shapes of a source layer to a destination layer in the shapshot.
Returns: Boolean
ResizeCopyLayerShapes
Description: Copies all the shapes from a src layer to a destination layer while resizing them by a give amount.
Returns: Boolean
ResizeLayerShapes
Description: Resizes the shapes on the given layer in place in the snapshot.
Returns: Boolean
ResizeShapes
Description: Resizes the shapes of this snapshot in place on each layer in the snapshot.
Returns: Boolean
SubtractLayersEx
Description: Process the shapes to subtract overlapping sections of shapes on layer B from shapes on layer A in the
snapshot.
Returns: Boolean
UnionLayersEx
Description: Process the shapes on the given source layers to combine overlapping shapes in the snapshot.
Returns: Boolean
UnionShapes
Returns: Boolean
LibraryElement
An MWOffice LibraryElement object.
Properties
LibraryElements
A collection of MWOffice LibraryElement objects.
Properties
Library
An MWOffice Library object.
Properties
Libraries
A collection of MWOffice Library objects.
Properties
MeasurementInfo
An MWOffice MeasurementInfo object contains information about measurement types available in the application.
Properties
MeasurementInfos
A collection of MWOffice MeasurementInfo objects.
Properties
Model
An MWOffice Model object.
Properties
Methods
None
Models
A collection of MWOffice Model objects.
Properties
LayoutCell
An MWOffice LayoutCell object.
Properties
LayoutCells
A collection of MWOffice LayoutCell objects.
Properties
Optimizer
An MWOffice Optimizer object.
Properties
Methods
Continue
Returns: Void
NewWindow
Returns: Window
Reset
Returns: Void
Revert
Returns: Void
Save
Returns: Void
Start
Returns: Void
Stop
Returns: Void
Events
NewLowCost
Description: Occurs when a new low cost has been arrived at.
Returns: HRESULT
NewUserMessage
Description: Occurs when the optimizer needs to display a message to the user.
Returns: HRESULT
SettingChanged
Returns: HRESULT
Started
Returns: HRESULT
StatusChanged
Description: Occurs when there has been a change in the Optimizer status.
Returns: HRESULT
Stopped
Returns: HRESULT
UpdateIteration
Returns: HRESULT
UpdateTotalCost
Returns: HRESULT
Synthesizer
An MWOffice Synthesis object.
Properties
Methods
Analyze
Returns: Void
Reset
Returns: Void
SetSynthesizeParameter
Returns: Void
Synthesize
Returns: Void
Sweeper
An MWOffice Sweeper object.
Properties
Methods
AddVariable
Returns: Void
RemoveVariable
Returns: Void
Update
Returns: Void
TuneVariable
A MWOffice TuneVariable object.
Properties
Methods
TuneDown
Description: Decrements the tuner nominal value by the amount of step value towards the minimum value.
Returns: Boolean
TuneUp
Description: Increments the tuner nominal value by the amount of step value towards the maximum value.
Returns: Boolean
TuneVariables
A collection of MWOffice TuneVariable objects.
Properties
Tuner
A MWOffice Tuner object.
Properties
Methods
Clear
Description: Clear the frozen sweep outputs fom the graphics and output documents.
Returns: Boolean
Freeze
Description: Freeze the current sweep output in the graphs and output documents.
Returns: Boolean
Restore
Description: Restore the state of the TuneVariables associated with the provided state name.
Returns: Boolean
Save
Description: Save the current state of the TuneVariables under the provided state name.
Returns: Boolean
Sweep
Returns: Boolean
Tag
Description: Tag the current state of the TuneVariables with the provided state name.
Returns: Boolean
ControlBarItem
An MWOffice ControlBarItem object.
Properties
Methods
None
ControlBarItems
A collection of MWOffice ControlBarItem objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ControlBarItem
Clear
Returns: Void
MenuBar
An MWOffice MenuBar object.
Properties
Methods
FreezeUpdates
Description: Prevents the MenuBar from updating changes that are made to it.
Returns: Void
UnfreezeUpdates
Description: Allows the MenuBar to update when changes are made to it.
Returns: Void
MenuBars
A collection of MWOffice MenuBar objects.
Properties
Menu
An MWOffice Menu object.
Properties
Methods
None
Menus
A collection of MWOffice Menu objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Menu
Clear
Returns: Void
MenuItem
An MWOffice MenuItem object.
Properties
Methods
None
MenuItems
A collection of MWOffice MenuItem objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: MenuItem
AddMenu
Returns: Menu
HotkeyTable
An MWOffice HotkeyTable object.
Properties
HotkeyTables
A collection of MWOffice HotkeyTable objects.
Properties
Methods
None
Hotkey
An MWOffice Hotkey object.
Properties
Methods
None
Hotkeys
A collection of MWOffice Hotkey objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Hotkey
Clear
Returns: Void
CommandTable
An MWOffice CommandTable object.
Properties
CommandTables
A collection of MWOffice CommandTable objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: CommandTable
Find
Returns: Command
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Command
An MWOffice Command object.
Properties
Methods
None
Commands
A collection of MWOffice Command objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Command
Syntax: Function Add(Name As String, [CmdId As Long], [Caption As String], [Image As Long], [Tooltip As String],
[Helpstring As String], [HelpFile As String], [HelpContextID As Long]) As Command
Clear
Returns: Void
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
DrawingShape
An MWOffice DrawingShape object.
Properties
Methods
Delete
Returns: Boolean
Move
Description: Moves DrawingShape object by the given values relative to the current location.
Returns: Boolean
Syntax: Function Move(dx As Long, dy As Long, [CCWRotation As Double = 0], [Flip As Boolean = 0], [FlipHorizontal
As Boolean = 0], [xOrigin As Double = 0], [yOrigin As Double = 0]) As Boolean
DrawingShapes
A collection of MWOffice DrawingShape objects.
Properties
Methods
AddArc
Returns: DrawingShape
Syntax: Function AddArc(Left As Long, Top As Long, Right As Long, Bottom As Long, xStart As Long, yStart As
Long, xEnd As Long, yEnd As Long) As DrawingShape
AddArrow
Returns: DrawingShape
AddEllipse
Returns: DrawingShape
Syntax: Function AddEllipse(Left As Long, Top As Long, Right As Long, Bottom As Long) As DrawingShape
AddLine
Returns: DrawingShape
AddPolygon
Returns: DrawingShape
AddPolyline
Returns: DrawingShape
AddRectangle
Returns: DrawingShape
Syntax: Function AddRectangle(Left As Long, Top As Long, Right As Long, Bottom As Long) As DrawingShape
AddText
Returns: DrawingShape
Syntax: Function AddText(Left As Long, Top As Long, Height As Long, Text As String, [FontName As String =
"Arial"], [Bold As Boolean = 0], [Italic As Boolean = 0]) As DrawingShape
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
Argument
An MWOffice Argument object.
Properties
Arguments
A collection of MWOffice Argument objects.
Properties
FlightLine
An MWOffice FlightLine object.
Properties
FlightLines
A collection of MWOffice FlightLine objects.
Properties
NetShape
An MWOffice NetShape object.
Properties
Methods
None
NetShapes
A collection of MWOffice NetShape objects.
Properties
Methods
AddEllipse
Returns: NetShape
Syntax: Function AddEllipse(x As Double, y As Double, dx As Double, dy As Double, [LayerName As String = ""],
[UseProcessLayers As Boolean = 0], [LayerMapping As String = ""]) As NetShape
AddPath
Returns: NetShape
Syntax: Function AddPath(XYPoints As SafeArray, Width As Double, [EndStyle As mwPathEndType = 1], [MiterStyle
As mwPathMiterType = 1], [OffsetMiterAmount As Double = 0], [LayerName As String = ""], [UseProcessLayers As
Boolean = 0], [LayerMapping As String = ""]) As NetShape
AddPolygon
Returns: NetShape
AddRectangle
Returns: NetShape
Syntax: Function AddRectangle(x As Double, y As Double, dx As Double, dy As Double, [LayerName As String = ""],
[UseProcessLayers As Boolean = 0], [LayerMapping As String = ""]) As NetShape
PhysicalNet
An MWOffice PhysicalNet object.
Properties
Methods
AssociateObject
Returns: Boolean
HighlightNet
Description: Sets the highlight state of the physical net to on or off and allows the specification of the highlight Color.
Returns: Boolean
PhysicalNets
A collection of MWOffice PhysicalNet objects.
Properties
RouteRecord
An MWOffice RouteRecord object.
Properties
Methods
AddGuide
Returns: RouteObject
Syntax: Function AddGuide(x1 As Double, y1 As Double, x2 As Double, y2 As Double, Begin As Long, End As Long)
As RouteObject
AddSegment
Returns: RouteObject
Syntax: Function AddSegment(x1 As Double, y1 As Double, x2 As Double, y2 As Double, Width As Double, LineType
As Long, BeginStyle As mwRouteSegmentEndStyleType, BeginExtent As Double, EndStyle As
mwRouteSegmentEndStyleType, EndExtent As Double) As RouteObject
AddVia
Returns: RouteObject
Syntax: Function AddVia(xOrigin As Double, yOrigin As Double, xExtent As Double, yExtent As Double, xOffset As
Double, yOffset As Double, LineType1 As Long, LineType2 As Long, Direction As mwRouteViaDirectionType) As
RouteObject
AddViaType
Returns: RouteObject
Syntax: Function AddViaType(xOrigin As Double, yOrigin As Double, xExtent As Double, yExtent As Double, xOffset
As Double, yOffset As Double, LineType1 As Long, LineType2 As Long, typeIndex As Long, Direction As
mwRouteViaDirectionType) As RouteObject
RemoveAll
Returns: Boolean
Route
An MWOffice Route object.
Properties
Methods
Delete
Returns: Boolean
Disassociate
Description: Removes the association the Route and it's parent PhysicalNet
Returns: Boolean
Routes
A collection of MWOffice Route objects.
Properties
Methods
AddRoute
Description: Adds the route described by the route record to the PhysicalNet object.
Returns: Route
AddVias
Description: Add the vias in the route record to the existing route objects. Allows adding vias after routes have been
created.
Returns: Boolean
CreateRouteRecord
Returns: RouteRecord
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
RouteObject
An MWOffice RouteObject object.
Properties
RouteObjects
A collection MWOffice RouteObject objects.
Properties
RouteSegment
An MWOffice RouteSegment object.
Properties
RouteSegments
A collection of MWOffice RouteSegment objects.
Properties
RouteVia
An MWOffice RouteVia object.
Properties
Methods
None
RouteVias
A collection MWOffice RouteVia objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: RouteVia
Syntax: Function Add(xOrigin As Double, yOrigin As Double, xExtent As Double, yExtent As Double, xOffset As
Double, yOffset As Double, LineType1 As Long, LineType2 As Long, Direction As mwRouteViaDirectionType) As
RouteVia
AddType
Description: Adds an object to the collection and returns a reference to the created object.
Returns: RouteVia
Syntax: Function AddType(xOrigin As Double, yOrigin As Double, xExtent As Double, yExtent As Double, xOffset
As Double, yOffset As Double, LineType1 As Long, LineType2 As Long, typeIndex As Long, Direction As
mwRouteViaDirectionType) As RouteVia
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
RouteGuide
An MWOffice RouteGuide object.
Properties
RouteGuides
A collection of MWOffice RouteGuide objects.
Properties
Extent
An MWOffice Extent object.
Properties
Extents
A collection of MWOffice Extent objects.
Properties
Pin
An MWOffice Pin Object.
Properties
Pins
A collection of MWOffice Pin objects.
Properties
LayoutModeSet
An MWOffice LayoutModeSet object.
Properties
Options
LayoutModeSets
A collection of MWOffice LayoutModeSet objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LayoutModeSet
GetActive
Returns: LayoutModeSet
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
SetActive
Returns: Boolean
ParameterDefaultValue
A MWOffice ParameterDefaultValue object.
Properties
ParameterDefaultValues
A MWOffice ParameterDefaultValue object.
Properties
LayoutProcessDefinition
An MWOffice LayoutProcessDefinition object.
Properties
Methods
Export
Returns: Boolean
UpdateAllDependentProcessDefinitions
Returns: Boolean
UpdateDependentProcessDefinition
Returns: Boolean
LayoutProcessDefinitions
A collection of MWOffice LayoutProcessDefinition objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: LayoutProcessDefinition
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Import
Description: Adds a Netlist object to the collection from a file and returns a reference to the created object.
Returns: LayoutProcessDefinition
Remove
Returns: Boolean
ProcessLayerInfo
An MWOffice ProcessLayerInfo object.
Properties
ProcessLayerInfos
A collection of MWOffice ProcessLayerInfo objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProcessLayerInfo
Syntax: Function Add(Name As String, [Offset As Double = 0], [MinimumWidth As Double = 0], [Flags As Long =
0]) As ProcessLayerInfo
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Void
ProcessTypeInfo
An MWOffice ProcessTypeInfo object.
Properties
ProcessTypeInfos
A collection of MWOffice ProcessTypeInfo objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProcessTypeInfo
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Void
ProcessBridgeInfo
An MWOffice ProcessBridgeInfo object.
Properties
ProcessBridgeInfos
A collection of MWOffice ProcessBridgeInfo objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProcessBridgeInfo
Syntax: Function Add(Name As String, [ShouldRemove As Boolean = -1], [RemoveOffset As Double = 0],
[ShouldRemoveEdge As Boolean = -1], [EdgeRemoveOffset As Double = 0]) As ProcessBridgeInfo
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Void
FontInfo
An MWOffice FontInfo object.
Properties
FontInfos
A collection of MWOffice FontInfo objects.
Properties
ProcessProperty
An MWOffice ProcessProperty object.
Properties
ProcessProperties
A collection of MWOffice ProcessProperties objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProcessProperty
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Void
ProcessViaType
An MWOffice ProcessViaType object.
Properties
ProcessViaTypes
A collection of MWOffice ProcessViaType objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProcessViaType
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Void
BusNetName
An MWOffice BusNetName object.
Properties
Methods
Delete
Returns: Boolean
Move
Returns: Boolean
Syntax: Function Move(dx As Long, dy As Long, [CCWRotation As Double = 0], [Flip As Boolean = 0], [FlipHorizontal
As Boolean = 0], [xOrigin As Double = 0], [yOrigin As Double = 0]) As Boolean
BusNetNames
A collection of MWOffice BusNetName objects.
Properties
BundleBit
An MWOffice BundleBit object.
Properties
BundleBits
A collection of MWOffuce BunldeBit objects.
Properties
BundleBus
An MWOffice BundleBus object.
Properties
BundleBuses
A collection of MWOffice BundleBus objects.
Properties
BundleInfo
An MWOffice BundleInfo object.
Properties
BundleInfos
A collection of MWOffice BundleInfo objects.
Properties
EditHandle
An MWOffice EditHandle object.
Properties
Methods
None
EditHandles
A collection of MWOffice EditHandle objects.
Properties
SelectFilterItem
An MWOffice SelectFilterItem object.
Properties
SelectFilterItems
A collection of MWOffice SelectFilterItem objects.
Properties
SelectFilter
An MWOffice SelectFilter object.
Properties
CSelectFilters
A collection of MWOffice SelectFilter objects.
Properties
MathUtil
An MWOffice MathUtil object.
Properties
Methods
ACos
Description: Returns the principal value of the arc cosine of a value, result is expressed in radians.
Returns: Double
ACosh
Description: Returns the arc hyperbolic cosine of a value, result is expressed in radians.
Returns: Double
ASin
Description: Returns the principal value of the arc sine of a value, result is expressed in radians.
Returns: Double
ASinh
Description: Returns the arc hyperbolic sine of a value, result is expressed in radians.
Returns: Double
ATan
Description: Returns the principal value of the arc tangent of a value, result is expressed in radians.
Returns: Double
ATan2
Description: Returns the principal value of the arc tangent of y / x, result is expressed in radians.
Returns: Double
ATanh
Description: Returns the arc hyperbolic tangent of a value, result is expressed in radians.
Returns: Double
Abs
Returns: Double
Avg
Returns: Double
Ceil
Description: Returns the smallest integral value that is not smaller than the specified number, rounds up.
Returns: Double
CelsiusToFahrenheit
Description: Converts a temperature value expressed in degrees Celsius to a temperature expressed in Fahrenheit
Returns: Double
Cos
Returns: Double
Cosh
Returns: Double
DegreesToRadians
Returns: Double
FahrenheitToCelsius
Description: Converts a temperature value expressed in degrees Fahrenheit to a temperature expressed in Celsius
Returns: Double
Floor
Description: Returns the largest integral value that is not larger than the specified number, rounds down.
Returns: Double
Int
Returns: Int
Log10
Returns: Double
LogN
Returns: Double
Max
Returns: Double
MicronsToMils
Returns: Double
MilsToMicrons
Description: Covnerts a length value expressed in mils to a length value expressed in microns
Returns: Double
Min
Returns: Double
Pow
Description: Returns the result of raising a base value to the given exponent value.
Returns: Double
RadiansToDegrees
Returns: Double
Round
Description: Returns the integral number that is nearest to the specified number.
Returns: Double
Sin
Returns: Double
Sinh
Returns: Double
Srand
Description: Initializes the pseudo-random number generator with the value provided as a seed.
Returns: Boolean
StdDev
Returns: Double
Tan
Returns: Double
Tanh
Returns: Double
Trunc
Description: Returns the integral value of the specified number rounded toward zero.
Returns: Double
exp
Returns: Double
StackupUtil
An MWOffice StackupUtil object.
Methods
AddConductorMaterial
Returns: Void
AddDielectricMaterial
Returns: Void
ClearStackup
Returns: Void
InsertDielectricLayer
Description: Add a dielectric layer to the designated STACKUP. Layer numbers are from top to bottom
Returns: Void
MapConductor
Returns: Void
Syntax: Sub MapConductor(drawing_layer As String, mat_name As String, Thickness As Double, em_layer As Int)
MapVia
Returns: Void
Syntax: Sub MapVia(drawing_layer As String, mat_name As String, from_em_layer As Int, to_em_layer As Int)
SetStackup
Returns: Void
SyncLpf
Description: Push data from STACKUP to named LPF. 3D data is thickness and z-position. Layer data is color and
hatch.
Returns: Void
ZipArchiveItem
An MWOffice ZipArchiveItem object.
Properties
Methods
None
ZipArchiveItems
A collection of MWOffice ZipArchiveItem objects.
Properties
Methods
ExtractAll
Returns: Boolean
ExtractItem
Returns: Boolean
ZipArchiveWriter
An MWOffice ZipArchiveWriter object.
Properties
Methods
AddContents
Returns: Boolean
AddDirectory
Returns: Boolean
AddFile
Returns: Boolean
Close
Returns: Boolean
BrowseForFolderDialog
An MWOffice BrowseForFolderDialog object.
Properties
Methods
None
FileFilterEntry
A MWOffice FileFitlerEntry object.
Properties
FileFilterEntries
A Collection of MWOffice FileFilterEntry objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: FileFilterEntry
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
FilePathEntry
A MWOffice FilePathEntry object.
Properties
FilePathEntries
A collection of MWOffice FilePathEntry objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: FilePathEntry
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
FilePathDialog
A MWOffice FilePathDialog object.
Properties
Methods
None
FileUtil
An MWOffice FileUtil object.
Properties
Methods
CreateBrowseForFolderDialog
Returns: BrowseForFolderDialog
CreateOpenFileDialog
Returns: FilePathDialog
CreateSaveFileDialog
Returns: FilePathDialog
GetFileInfo
Returns: FileInfo
GetFolderInfo
Returns: FolderInfo
NewZipArchive
Returns: ZipArchiveWriter
OpenZipArchive
Returns: ZipArchiveItems
ShowFile
Returns: Boolean
Syntax: Function ShowFile(FilePath As String, [Type As mwShowFileType = 0], [Flags As Long = 0]) As Boolean
FileAttribute
An MWOffice FileAttribute object.
Properties
FileAttributes
A collection of FileAttribute objects.
Properties
ScriptRoutine
A MWOffice ScriptRoutine object.
Properties
Methods
None
ScriptRoutines
A collection of ScriptRoutine objects.
Properties
ScriptModule
A MWOffice ScriptModule object.
Properties
Methods
None
ScriptModules
A collection of ScriptModule objects.
Properties
Methods
None
SimulationResult
An MWOffice SimulationResult object.
Properties
SimulationResults
A collection of MWOffice SimulationResult objects.
Properties
Methods
Restore
Returns: Boolean
Save
Returns: Boolean
Syntax: Function Save(Filename As String, [SaveMinSet As Boolean = 0], [SaveDynamicData As Boolean = 0],
[SaveExtendedData As Boolean = 0]) As Boolean
SimulationFilter
An MWOffice SimulationFilter object.
Properties
Methods
AddConfigurationName
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
ClearConfigurationNames
Returns: Void
ConfigurationNameExist
Description: Returns whether an item matching the specified criteria exists in the collection.
Returns: Boolean
DocNameAdd
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
DocNameExist
Description: Returns whether an item matching the specified criteria exists in the collection.
Returns: Boolean
DocNameRemove
Returns: Boolean
DocNamesClear
Returns: Void
RemoveConfigurationName
Returns: Boolean
SimulationTypeAdd
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
SimulationTypeExist
Description: Returns whether an item matching the specified criteria exists in the collection.
Returns: Boolean
SimulationTypeRemove
Returns: Boolean
SimulationTypesClear
Returns: Void
VendorNameAdd
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Boolean
VendorNameExist
Description: Returns whether an item matching the specified criteria exists in the collection.
Returns: Boolean
VendorNameRemove
Returns: Boolean
VendorNamesClear
Returns: Void
SimulationFilters
A collection of MWOffice SimulationFilter objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: SimulationFilter
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Void
RemoveAll
Returns: Void
SwitchList
An MWOffice SwitchList object.
Properties
SwitchLists
A collection of MWOffice SwitchList objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: SwitchList
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Void
RemoveAll
Returns: Void
ConnectionRule
A MWOffice ConnectionRule object.
Properties
ConnectionRules
A collection of MWOffice ConnectionRule objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ConnectionRule
RemoveAll
Returns: Boolean
UpdateConnectivity
Returns: Boolean
CrossoverRuleEntry
A MWOffice CrossoverRuleEntry object.
Properties
CrossoverRuleEntries
A collection of MWOffice CrossoverRuleEntry objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: CrossoverRuleEntry
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
CrossoverRule
A MWOffice CrossoverRule object.
Properties
CrossoverRules
A collection of MWOffice CrossoverRule objects.
Properties
Methods
CreateNew
Description: Adds an object to the collection and returns a reference to the created object.
Returns: CrossoverRule
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
ProcessViaFillEntry
A MWOffice ProcessViaFillEntry object.
Properties
ProcessViaFillEntries
A collection of MWOffice ProcessViaFillEntry objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProcessViaFillEntry
Syntax: Function Add(entryName As String, libName As String, CellName As String, SpacingX As Double, SpacingY
As Double, Clearance As Double, [SpacingType As mwViaSpacingType = 0], [OffsetX As Double = 0], [OffsetY As
Double = 0], [bStaggerMode As mwViaFillStaggerMode = 0]) As ProcessViaFillEntry
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
ProcessViaFenceEntry
A MWOffice ProcessViaFenceEntry object.
Properties
ProcessViaFenceEntries
A collection of MWOffice ProcessViaFenceEntry objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProcessViaFenceEntry
Syntax: Function Add(entryName As String, libName As String, CellName As String, Spacing As Double, [SpacingType
As mwViaSpacingType = 0], [OffsetX As Double = 0], [OffsetY As Double = 0], [MergePerimeters As Boolean = -1],
[PerimeterOversize As Double = 0], [OpenPathEnds As Boolean = -1], [PathAspectRatio As Double = 5]) As
ProcessViaFenceEntry
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
ProcessViaLineType
An MWOffice ProcessViaLineType object.
Properties
ProcessViaLineTypePair
An MWOffice ProcessViaLineTypePair object.
Properties
ProcessViaLineTypePairs
A collection of MWOffice ProcessViaLineTypePair objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProcessViaLineTypePair
Remove
Returns: Boolean
RemoveAll
Returns: Void
CellMapping
An MWOffice CellMapping object.
Properties
CellMappings
A collection of MWOffice CellMapping objects.
Properties
EMPortTermination
A MWOffice EMPortTermination object.
Properties
EMPortTerminations
A collection of MWOffice EMPortTermination objects.
Properties
EMPort
A MWOffice EMPort object.
Properties
EMPorts
A collection of MWOffice EMPort objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: EMPort
Syntax: Function Add(Type As mwEMShapePortType, p1x As Double, p1y As Double, p2x As Double, p2y As Double)
As EMPort
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
CellInfo
A MWOffice CellInfo object.
Properties
SweepLabel
A SweepLabel object contains information about the swept variable values for a particular measurement trace.
Properties
SweepLabels
A collection of MWOffice SweepLabel objects.
Properties
LayoutInfo
A MWOffice LayoutInfo object.
Properties
ComponentTest
A MWOffice ComponentTest object.
Properties
Methods
RunTest
Returns: Boolean
SaveResult
Description: Saves the various types of output results from the component test to a file.
Returns: Boolean
ComponentTests
A collection of ComponentTest objects.
Properties
StatusItem
A MWOffice StatusItem object.
Properties
Methods
Activate
Returns: Void
Delete
Returns: Void
StatusItems
A collection of MWOffice StatusItem objects.
Properties
Methods
None
StatusGroup
A MWOffice StatusGroup object.
Properties
Methods
RemoveAllItems
Returns: Void
Search
Description: Returns a reference to a collection MWOffice StatusItems matching the given criteria.
Returns: StatusItems
StatusGroups
A collection of MWOffice StatusGroup objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: StatusGroup
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
StatusWindow
The MWOffice StatusWindow object.
Properties
Status
A collection of MWOffice StatusGroup objects.
Properties
Methods
CopyToClipboard
Returns: Boolean
RemoveAllItems
Returns: Void
Search
Description: Returns a reference to a collection MWOffice StatusItems matching the given criteria.
Returns: StatusItems
CursorInfo
A MWOffice CursorInfo object.
Properties
View
A MWOffice View object.
Properties
Methods
ReDraw
Returns: Void
ViewAll
Returns: Void
ViewArea
Description: Zooms the view to display the area defined by the given coordinates.
Returns: Void
ZoomIn
Description: Zooms the view in to the center of the current location to display approximately half the current area.
Returns: Void
ZoomOut
Description: Zooms the view out at the current location to display approximately twice the current area.
Returns: Void
ZoomPrev
Description: Returns the window display to the previously displayed zoom level.
Returns: Void
ZoomSelected
Description: Zooms the view to display the area which includes all selected objects.
Returns: Void
Views
A collection of MWOffice View objects.
Properties
ThreeDView
A MWOffice 3DView object.
Properties
Methods
ReDraw
Returns: Void
ViewAll
Returns: Void
ViewArea
Description: Zooms the view to display the area defined by the given coordinates.
Returns: Void
ZoomIn
Description: Zooms the view in to the center of the current location to display approximately half the current area.
Returns: Void
ZoomOut
Description: Zooms the view out at the current location to display approximately twice the current area.
Returns: Void
ZoomPrev
Description: Returns the window display to the previously displayed zoom level.
Returns: Void
ZoomSelected
Description: Zooms the view to display the area which includes all selected objects.
Returns: Void
ThreeDViews
A collection of MWOffice 3D View objects.
Properties
EmbeddedDesign
A MWOffice EmbeddedDesign object.
Properties
EmbeddedDesigns
A collection of MWOffice EmbeddedDesign objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: EmbeddedDesign
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
EMail
A MWOffice EMail object.
Properties
FileInfo
A MWOffice FileInfo object.
Properties
FileInfos
A collection of MWOffice FileInfo objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: FileInfo
Remove
Returns: Boolean
RemoveAll
Returns: Void
FolderInfo
A MWOffice FolderInfo object.
Properties
FolderInfos
A collection of MWOffice FolderInfo objects.
Properties
ProjectTreeView
A MWOffice project TreeView object.
Properties
Methods
Hide
Returns: Void
Show
Returns: Void
TreeNode
A MWOffice TreeNode object.
Properties
Methods
Check
Returns: Void
Collapse
Returns: Void
Expand
Returns: Void
Select
Returns: Void
Uncheck
Returns: Void
TreeNodes
A collection of MWOffice TreeNode objects.
Properties
ProjectItem
A MWOffice ProjectItem object.
Properties
ProjectItems
A collection of MWOffice ProjectItem objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: ProjectItem
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
UserFolder
A MWOffice Folder object.
Properties
Methods
None
UserFolders
A collection of MWOffice Folder objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: UserFolder
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Boolean
WizardDoc
A MWOffice WizardDoc instance object.
Properties
Methods
Edit
Returns: Void
Remove
Returns: Void
WizardDocs
A collection of MWOffice WizardDoc objects.
Properties
Methods
CreateNew
Returns: Object
Remove
Returns: Boolean
Wizard
A MWOffice Wizard definition object.
Properties
Methods
CreateNew
Returns: Object
Run
Description: Creates an instance of the MWOffice Wizard object and runs it.
Returns: Object
Wizards
A collection of MWOffice Wizard objects.
Properties
Annotation
A MWOffice Annotation object.
Properties
Methods
None
Annotations
A collection of MWOffice Annotation objects.
Properties
Methods
Add
Description: Adds an object to the collection and returns a reference to the created object.
Returns: Annotation
GetUniqueName
Description: Returns a unique name to be used when adding objects to the collection.
Returns: String
Remove
Returns: Boolean
RemoveAll
Returns: Void
RegressionTester
A MWOffice RegressionTester object.
Methods
CompareEMInputDataFiles
Returns: Boolean
CompareGdsiiFiles
Returns: Boolean
GenerateReferenceDataFiles
Returns: Boolean
GenerateReferenceEM3DModelFiles
Returns: Boolean
GenerateReferenceEMInputDataFiles
Description: Generate new EM input data regression test reference data files.
Returns: Boolean
GenerateReferenceGdsiiFiles
Returns: Boolean
RunRegressionTestList
Returns: RegressionResult
RegressionResult
A MWOffice RegressionResult object.
Properties
JobEntry
A MWOffice JobEntry object.
Properties
Methods
Cancel
Description: Cancels the JobEntry object if it has not yet started or ended.
Returns: Boolean
Pause
Returns: Boolean
Resume
Returns: Boolean
JobEntries
A collection of JobEntry objects.
Properties
JobQueue
A MWOffice JobQueue object.
Properties
JobQueues
A collection of JobQueue objects.
Properties
JobSchedulerQuery
A MWOffice JobSchedulerQuery object.
Properties
JobMonitor
A MWOffice JobMonitor object.
Properties
PageSetup
A MWOffice PageSetup object.
Properties
RoutePropertyInfo
A MWOffice RoutePropertyInfo object.
Properties
mwFeatureTypeFlags
Constants that define the project features.
Name Value
mwFTF_CircuitSimulator 1
mwFTF_NonLinearSimulator 2
mwFTF_EMSimulator 4
mwFTF_Layout 8
mwFTF_SystemSimulator 16
mwFTF_AdvancedSystem 32
mwFTF_AdvancedMWO 64
mwFTF_MMIC 128
mwShapeToolFlags
Constants that define the types of shape tools.
Name Value
mwSTF_Rectangle 1
mwSTF_Polygon 2
mwSTF_Path 4
mwSTF_Ellipse 8
Name Value
mwSTF_Intersect 16
mwSTF_Union 32
mwSTF_Subtract 64
mwSTF_Xor 128
mwSTF_Resize 256
mwSTF_ResizeCopy 512
mwSTF_Ring 1024
mwSTF_DrillHole 2048
mwSTF_Group 4096
mwSTF_UnGroup 8192
mwSTF_ArrayCopy 16384
mwSTF_StretchArea 32768
mwSTF_Sliced 65536
mwSTF_Text 131072
mwSTF_Ruler 262144
mwSTF_DimLine 524288
mwAlignToolFlags
Constants that define the types of alignment tools.
Name Value
mwATF_Top 1
mwATF_Bottom 2
mwATF_VertCenter 4
mwATF_Left 8
mwATF_Right 16
mwATF_HorzCenter 32
mwATF_SpaceV 64
mwATF_SpaceH 128
mwProjectToolFlags
Constants that define the types of project tools.
Name Value
mwPTF_Undo 1
mwPTF_Redo 2
mwPTF_ZoomArea 4
Name Value
mwPTF_ZoomOut 8
mwPTF_AutoView 16
mwPTF_Tune 32
mwPTF_SnapTogether 64
mwPTF_SnapToFit 128
mwPTF_SnapAll 256
mwPTF_AnchorTool 512
mwPTF_Measure 1024
mwPTF_ViewSchematic 2048
mwPTF_ViewLayout 4096
mwPTF_View3D 8192
mwPTF_GridMult 16384
mwPTF_DRC 32768
mwLinearSolveType
Constants that define the solution types available in the linear circuit simulator.
Name Value
mwLST_Smart 0
mwLST_Sparse 1
mwLST_Full 2
mwNonLinearSolveType
Constants that define the solution types available in the non-linear circuit simulator.
Name Value
mwNLST_Smart 0
mwNLST_Iterative 1
mwNLST_Direct 2
mwEMSolverType
Constants that define the matrix solution types available in the EM simulator.
Name Value
mwEMST_DefaultDirect 0
mwEMST_FullDirect 1
mwEMST_SymetricDirect 2
mwEMST_IterativeLarge 3
Name Value
mwEMST_IterativeMedium 4
mwEMST_IterativeSmall 5
mwEMST_IterativeCustom 6
mwEMSolverToleranceLevel
Constants that define the tolerance level for the matrix solver.
Name Value
mwEMSL_Low 0
mwEMSL_Medium 1
mwEMSL_High 2
mwEMSL_VeryHigh 3
mwEMMeshDensity
Constants that define the mesh density levels available for EM simulation.
Name Value
mwEMMD_High 0
mwEMMD_Normal 1
mwEMMD_Medium 2
mwEMME_Low 3
mwColor
Constants that define different types of standard colors.
Name Value
mwCLR_AliceBlue 16775408
mwCLR_AntiqueWhite 14150650
mwCLR_Aqua 16776960
mwCLR_Aquamarine 13959039
mwCLR_Azure 16777200
mwCLR_Beige 14480885
mwCLR_Bisque 12903679
mwCLR_Black 0
mwCLR_BlanchedAlmond 13495295
mwCLR_Blue 16711680
mwCLR_BlueViolet 14822282
mwCLR_Brown 2763429
Name Value
mwCLR_BurlyWood 8894686
mwCLR_CadetBlue 10526303
mwCLR_Chartreuse 65407
mwCLR_Chocolate 1993170
mwCLR_Coral 5275647
mwCLR_CornflowerBlue 15570276
mwCLR_Cornsilk 14481663
mwCLR_Crimson 3937500
mwCLR_Cyan 16776960
mwCLR_DarkBlue 9109504
mwCLR_DarkCyan 9145088
mwCLR_DarkGoldenrod 755384
mwCLR_DarkGray 11119017
mwCLR_DarkGreen 25600
mwCLR_DarkKhaki 7059389
mwCLR_DarkMagenta 9109643
mwCLR_DarkOliveGreen 3107669
mwCLR_DarkOrange 36095
mwCLR_DarkOrchid 13382297
mwCLR_DarkRed 139
mwCLR_DarkSalmon 8034025
mwCLR_DarkSeaGreen 9157775
mwCLR_DarkSlateBlue 9125192
mwCLR_DarkSlateGray 5197615
mwCLR_DarkTurquoise 13749760
mwCLR_DarkViolet 13828244
mwCLR_DeepPink 9639167
mwCLR_DeepSkyBlue 16760576
mwCLR_DimGray 6908265
mwCLR_DodgerBlue 16748574
mwCLR_Firebrick 2237106
mwCLR_FloralWhite 15792895
mwCLR_ForestGreen 2263842
mwCLR_Fuchsia 16711935
mwCLR_Gainsboro 14474460
mwCLR_GhostWhite 16775416
mwCLR_Gold 55295
Name Value
mwCLR_Goldenrod 2139610
mwCLR_Gray 8421504
mwCLR_Green 32768
mwCLR_GreenYellow 3145645
mwCLR_Honeydew 15794160
mwCLR_HotPink 11823615
mwCLR_IndianRed 6053069
mwCLR_Indigo 8519755
mwCLR_Ivory 15794175
mwCLR_Khaki 9234160
mwCLR_Lavender 16443110
mwCLR_LavenderBlush 16118015
mwCLR_LawnGreen 64636
mwCLR_LemonChiffon 13499135
mwCLR_LightBlue 15128749
mwCLR_LightCoral 8421616
mwCLR_LightCyan 16777184
mwCLR_LightGoldenrodYellow 13826810
mwCLR_LightGray 13882323
mwCLR_LightGreen 9498256
mwCLR_LightPink 12695295
mwCLR_LightSalmon 8036607
mwCLR_LightSeaGreen 11186720
mwCLR_LightSkyBlue 16436871
mwCLR_LightSlateGray 10061943
mwCLR_LightSteelBlue 14599344
mwCLR_LightYellow 14745599
mwCLR_Lime 65280
mwCLR_LimeGreen 3329330
mwCLR_Linen 15134970
mwCLR_Magenta 16711935
mwCLR_Maroon 128
mwCLR_MediumAquamarine 11193702
mwCLR_MediumBlue 13434880
mwCLR_MediumOrchid 13850042
mwCLR_MediumPurple 14381203
mwCLR_MediumSeaGreen 7451452
Name Value
mwCLR_MediumSlateBlue 15624315
mwCLR_MediumSpringGreen 10156544
mwCLR_MediumTurquoise 13422920
mwCLR_MediumVioletRed 8721863
mwCLR_MidnightBlue 7346457
mwCLR_MintCream 16449525
mwCLR_MistyRose 14804223
mwCLR_Moccasin 11920639
mwCLR_NavajoWhite 11394815
mwCLR_Navy 8388608
mwCLR_OldLace 15136253
mwCLR_Olive 32896
mwCLR_OliveDrab 2330219
mwCLR_Orange 42495
mwCLR_OrangeRed 17919
mwCLR_Orchid 14053594
mwCLR_PaleGoldenrod 11200750
mwCLR_PaleGreen 10025880
mwCLR_PaleTurquoise 15658671
mwCLR_PaleVioletRed 9662683
mwCLR_PapayaWhip 14020607
mwCLR_PeachPuff 12180223
mwCLR_Peru 4163021
mwCLR_Pink 13353215
mwCLR_Plum 14524637
mwCLR_PowderBlue 15130800
mwCLR_Purple 8388736
mwCLR_Red 255
mwCLR_RosyBrown 9408444
mwCLR_RoyalBlue 14772545
mwCLR_SaddleBrown 1262987
mwCLR_Salmon 7504122
mwCLR_SandyBrown 6333684
mwCLR_SeaGreen 5737262
mwCLR_SeaShell 15660543
mwCLR_Sienna 2970272
mwCLR_Silver 12632256
Name Value
mwCLR_SkyBlue 15453831
mwCLR_SlateBlue 13458026
mwCLR_SlateGray 9470064
mwCLR_Snow 16448255
mwCLR_SpringGreen 8388352
mwCLR_SteelBlue 11829830
mwCLR_Tan 9221330
mwCLR_Teal 8421376
mwCLR_Thistle 14204888
mwCLR_Tomato 4678655
mwCLR_Turquoise 13688896
mwCLR_Violet 15631086
mwCLR_Wheat 11788021
mwCLR_White 16777215
mwCLR_WhiteSmoke 16119285
mwCLR_Yellow 65535
mwCLR_YellowGreen 3329434
mwGraphColorIndex
Constants that define indexes for the graph color values for graph color options.
Name Value
mwGCI_Black 0
mwGCI_Red 1
mwGCI_Green 2
mwGCI_Blue 3
mwGCI_Magenta 4
mwGCI_Brown 5
mwGCI_Cyan 6
mwGCI_Yellow 7
mwGCI_Gray 8
mwGCI_LtGray 9
mwGraphLineStyleIndex
Constants that define indexes for the graph line style values for graph line style options.
Name Value
mwGLS_SolidLine 0
mwGLS_DashedLine 1
mwGLS_DottedLine 2
mwGLS_DotDashLine 3
mwGraphLineWeightIndex
Consants that define index for the graph line weight values for graph line weight options.
Name Value
mwGLW_1PixelWidth 0
mwGLW_2PixelWidth 1
mwGLW_3PixelWidth 2
mwGLW_4PixelWidth 3
mwGLW_5PixelWidth 4
mwGraphLegendStyleIndex
Constants that define index values pf legend styles for the legend text entries.
Name Value
mwGLE_DataName 0
mwGLE_MeasurementName 1
mwGLE_BothNames 2
mwGraphYieldRangeStyle
Constants that define different modes for dispalying range values for yield data.
Name Value
mwGYR_MinAndMax 0
mwGYR_Envelope 1
mwGYR_RangeBox 2
mwGraphYieldDisplayStyle
Constants that define different modes for displaying traces for yield data.
Name Value
mwGYD_AllTraces 0
mwGYD_Passed 1
mwGYD_Failed 2
Name Value
mwGYD_Mean 3
mwLayoutViewDetails
Constants that define different levels of layout viewing details.
Name Value
mwLVD_AllDetails 0
mwLVD_NormalDetails 1
mwLVD_LowDetails 2
mwLVD_VeryLowDetails 3
mwLayoutSelectMode
Constants that define different types of layout selection modes.
Name Value
mwLSM_AutoSelect 0
mwLSM_ManualSelect 1
mwLayoutRouteGravity
Constants that define different levels of layout route inference snap gravity.
Name Value
mwLRG_NoneGravity 0
mwLRG_WeakGravity 1
mwLRG_NormalGravity 2
mwLRG_StrongGravity 3
mwSysNoiseModeling
Constants that define different modes of system noise modeling.
Name Value
mwSNM_Noiseless 0
mwSNM_RFBudgetOnly 1
mwSNM_RFBudgetAndTimeDomain 2
mwLayoutSnapMode
Constants that define different types of layout snap modes.
Name Value
mwLSM_Auto 0
mwLSM_Manual 1
mwLSM_Selected 2
mwInterpolationMethod
Constants that define different methods for value interpolation.
Name Value
mwIM_Linear 0
mwIM_RationalFunction 1
mwIM_SplineCurve 2
mwInterpolationCoords
Constants that define different interpolation coordinate system types.
Name Value
mwIC_Cartesian 0
mwIC_Polar 1
mwInstanceExportOptions
Constants that define different options for exporting instances from layout.
Name Value
mwIEO_NoChangesToCellNames 0
mwIEO_AppendNumberToDuplicates 1
mwIEO_AppendLibNameToDuplicates 2
mwIEO_AppendLibNameToAll 3
mwFaceInsetOptions
Constants that define different options for inserting layout cell faces.
Name Value
mwFIO_NoInset 0
mwFIO_InsetNonOrthogOneQtrDbUnit 1
mwFIO_InsetNonOrthogOneHalfDbUnit 2
mwFIO_InsetNonOrthogThreeQtrDbUnit 3
mwFIO_InsetNonOrthogOneDbUnit 4
mwFIO_InsetAllOneQtrDbUnit 5
Name Value
mwFIO_InsetAllOneHalfDbUnit 6
mwFIO_InsetAllThreeQtrDbUnit 7
mwFIO_InsetAllOneDbUnit 8
mwPortFaceConnectTypes
Constants that define different types of face connection options.
Name Value
mwCT_Unknown 0
mwCT_CapTopPlate 1
mwCT_CapBotPlate 2
mwCT_SpiralExit 3
mwCT_SpiralTurn 4
mwCT_ViaTop 5
mwCT_ViaBottom 6
mwCT_Resistor 7
mwCT_Resistor2 8
mwCT_Resistor3 9
mwCT_Disabled 10
mwCT_LineEnd 100
mwCT_LineEndN 199
mwCT_LineJunction 200
mwCT_LineJunctionN 299
mwCT_ArtworkLine 300
mwCT_ArtworkLineN 399
mwCT_PassThroughBase 399
mwCT_PassThrough 400
mwCT_PassThroughN 499
mwPathEndTypeOptions
Constants that define different options for path end types.
Name Value
mwPETO_ExtendedHalfWidth 0
mwPETO_FlushEnd 1
mwPETO_Rounded 2
mwPathMiterTypeOptions
Constants that define different options for path miter types.
Name Value
mwPMTO_Square 0
mwPMTO_Mitered 1
mwPMTO_OffsetMiter 2
mwRectangleAttributes
Constants that define different types of Rectangle attributes.
Name Value
mwRA_LayerIndex 0
mwPolygonAttributes
Constants that define different types of Polygon attributes.
Name Value
mwPOA_LayerIndex 0
mwPOA_Area 1
mwLayoutCellAttributes
Constants that define different types of Layout Cell attributes.
Name Value
mwLCA_LineTypeIndex 0
mwLCA_UsesProcessLayers 1
mwLCA_LayerMappingIndex 2
mwLCA_Anchor 3
mwLCA_Frozen 4
mwLCA_CellName 5
mwLCA_ElementName 6
mwLayoutShapeAttributes
Constants that define different types of Layout Shape attributes.
Name Value
mwLSA_LineTypeIndex 0
mwLSA_UsesProcessLayers 1
Name Value
mwLSA_LayerMappingIndex 2
mwLSA_LayerIndex 3
mwLayoutPinAttributes
Constants that define different types of Layout Pin attributes.
Name Value
mwLPA_PortNumber 0
mwLPA_ConnectType 1
mwLPA_PinGroup 2
mwLPA_GroupType 3
mwLayoutRoutePathAttributes
Constants that define different types of Layout Route attributes.
Name Value
mwLRP_NetworkId 0
mwLRP_Associated 1
mwLayoutNetShapeAttributes
Constants that define different types of LayoutNetShape attributes.
Name Value
mwLNS_NetworkId 0
mwLNS_Associated 1
mwLayoutCellShapeAttributes
Constants that define the different types of LayoutCellShape attributes.
Name Value
mwLCS_CellName 0
mwLCS_IsArtwork 1
mwLayoutSubcircuitAttributes
Constanst that define the different types of LayoutSubcircuit attributes.
Name Value
mwLSA_MasterDocName 0
mwLayoutGroupAttributes
Constants that define the different types of Layout Group attributes.
Name Value
mwLGA_GroupChildCount 0
mwLayoutLayerAttributes
Constants that define the different types of LayoutLayer attributes.
Name Value
mwLLA_LayerName 0
mwLayoutMagnificationAttributes
Constants that define different types of layout magnification attributes.
Name Value
mwLMA_Magnification 0
mwLayout3DPlacementAttributes
Constants that define different types of layout 3D placement attributes.
Name Value
mwTDP_EmLayer 0
mwTDP_ZOffset 1
mwTDP_XAngle 2
mwTDP_YAngle 3
mwLayoutOrientationAttributes
Constants that define different types of layout orientation attributes.
Name Value
mwLOA_FixedPosition 0
mwLOA_FlipState 1
mwLOA_RotationAngle 2
mwLayoutCellStretcherAttributes
Constants that define different types of layout cell stretcher attributes.
Name Value
mwLCS_ParameterName 0
mwLCS_Multiplier 1
mwLCS_Offset 2
mwLCS_UpperLimit 3
mwLCS_LowerLimit 4
mwLCS_IsBound 5
mwLCS_Direction 6
mwLCS_ArrowHeight 7
mwLayoutDragLayoutObjectAttributes
Constants that define different types of layout drag object attributes.
Name Value
mwDLO_UseForAnchor 0
mwDLO_StretchToFix 1
mwLayoutFontAttributes
Constants that define different types of layout font attributes.
Name Value
mwLFA_FontName 0
mwLFA_BoldStyle 1
mwLFA_ItalicStyle 2
mwLFA_FontHeight 3
mwSchematicFontAttributes
Constants that define different types of schematic font attributes.
Name Value
mwSFA_FontName 0
mwSFA_BoldStyle 1
mwSFA_ItalicStyle 2
mwSFA_FontHeight 3
mwLayoutTextAttributes
Constants that define different types of layout text attributes.
Name Value
mwLTA_DrawTextAsPoly 0
mwLTA_DrawTextArrow 1
mwLTA_ArrowPointX 2
mwLTA_ArrowPointY 3
mwLTA_TextString 4
mwLayoutDimensionLineAttributes
Constants that define different types of layout dimension line attributes.
Name Value
mwDLA_ArrowLocation 0
mwDLA_TextLocation 1
mwDLA_ArrowLength 2
mwDLA_GapLength 3
mwDLA_Precision 4
mwDLA_ShowUnits 5
mwDLA_ShowTolerance 6
mwDLA_LengthTolerance 7
mwDLA_Length 8
mwLayoutRulerAttributes
Constants that define different types of layout ruler attributes.
Name Value
mwLRA_RulerSpacing 0
mwLRA_GapLength 1
mwLRA_TickHeight 2
mwLRA_Precision 3
mwLRA_ShowUnits 4
mwLRA_MinorTickSpacing 5
mwLRA_MinorTickHeight 6
mwLRA_ShowMinorTicks 7
mwLRA_ShowLabels 8
mwLRA_Length 9
mwLayoutPolyAttributes
Constants that define different types of layout polygon attributes.
Name Value
mwLP_Area 0
mwLayoutEllipseAttributes
Constants that define different types of layout ellipse attributes.
Name Value
mwLEA_Area 0
mwLEA_Width 1
mwLEA_Height 2
mwLEA_Eccentricity 3
mwLayoutPathAttributes
Constants that define different types of layout path attributes.
Name Value
mwLPA_PathWidth 0
mwLPA_PathEndType 1
mwLPA_MiterType 2
mwLPA_OffsetMiterAmount 3
mwLPA_BeginExt 4
mwLPA_EndExt 5
mwLPA_Length 6
mwLayoutPolylineAttributes
Constants that define different types of layout polyline attributes.
Name Value
mwLPLA_Length 0
mwLayoutArcAttributes
Constants that define different types of layout arc attributes.
Name Value
mwLAA_CenterX 0
mwLAA_CenterY 1
mwLAA_Radius 2
mwLAA_StartAngle 3
mwLAA_StopAngle 4
mwLayoutFaceAttributes
Constants that define different types of layout face attributes.
Name Value
mwFAT_FaceJustification 0
mwFAT_XOffset 1
mwFAT_YOffset 2
mwFAT_AngleOffset 3
mwLayoutDrillHoleAttributes
Constants that define different types of layout drill hole attributes.
Name Value
mwDHA_DrillHoleIndex 0
mwEmExtractAtrributes
Constants that define different types of layout EM extraction attributes.
Name Value
mwEEA_IsEMExtract 0
mwEEA_GroupName 1
mwEllipseAttributes
Constants that define different types of Ellipse attributes.
Name Value
mwEA_LayerIndex 0
mwEA_Area 1
mwEA_Width 2
mwEA_Height 3
mwEA_Eccentricity 4
mwArcAttributes
Constants that define different types of Arc attributes.
Name Value
mwAA_LayerIndex 0
mwAA_CenterX 1
mwAA_CenterY 2
Name Value
mwAA_Radius 3
mwAA_StartAngle 4
mwAA_StopAngle 5
mwAA_Length 6
mwPolylineAttributes
Constants that defined different types of Polyline attributes.
Name Value
mwPLA_LayerIndex 0
mwPLA_Length 1
mwPathAttributes
Constants that define attributes of a shape path object.
Name Value
mwPA_LayerIndex 0
mwPA_PathWidth 1
mwPA_PathEndType 2
mwPA_MiterType 3
mwPA_OffsetMiterAmount 4
mwPA_BeginExt 5
mwPA_EndExt 6
mwPA_Length 7
mwPA_Area 8
mwArrayCellAttributes
Constants that define attributes of an array cell object.
Name Value
mwACA_IsArrayCell 0
mwACA_ArrayCellRows 1
mwACA_ArrayCellCols 2
mwACA_ArrayCellDx 3
mwACA_ArrayCellDy 4
mwCellStretcherAttributes
Constants that define different attribute types for cell stretcher shapes
Name Value
mwCSA_StretchType 0
mwCSA_ParameterName 1
mwCSA_Multipler 2
mwCSA_Offset 3
mwCSA_UpperLimit 4
mwCSA_LowerLimit 5
mwCSA_ArrowHeight 6
mwCSA_IsBound 7
mwCSA_Region 8
mwSymbolTextAttributes
Constants that define different types of symbol text attributes.
Name Value
mwSTA_Height 1
mwSTA_Width 2
mwSTA_Rotation 3
mwSTA_Text 4
mwSTA_Font 5
mwSymbolPathAttributes
Constants that define different types of symbol path attributes.
Name Value
mwSPA_Width 1
mwSPA_MiterType 2
mwSPA_MiterOffset 3
mwSPA_endType 4
mwSPA_bOffset 5
mwSPA_eOffset 6
mwLayoutConnectionLineTypes
Constants that define different types of layout connection line drawing.
Name Value
mwLCL_StaightLines 0
mwLCL_CenterPointLines 1
mwLCL_MinimumSpanningLines 2
mwSpiceExtractionModelLevel
Constants that define different spice model extraction levels
Name Value
mwSML_Simplest 0
mwSML_1stOrder 1
mwSML_2ndOrder 2
mwSML_Distributed 3
mwSML_MostAccurate 4
mwINetModelingLevel
Constants that define different iNet modeling accuracy levels
Name Value
mwNML_ShortCircuits 0
mwNML_RCLumped 1
mwNML_RLCLumped 2
mwNML_Distrubuted 3
mwNML_EmExtraction 4
mwModelCompatibilityVersion
Constants that define different model compatibility version levels
Name Value
mwMCV_Version553 553
mwMCV_Version600 600
mwMCV_Version650 650
mwMCV_Version750 750
mwMCV_Version800 800
mwMCV_Version900 900
mwRouteObstructionLevel
Constants that define different routing obstruction avoidance levels
Name Value
mwROL_IgnoreObstructions 0
mwROL_IgnoreExistingNets 1
mwROL_AvoidObjstructions 2
mwModelExtractType
Constants that define different model options for an element.
Name Value
mwMET_CircuitBasedModel 0
mwMET_EMExtractedModel 1
mwDrawingTextAttributes
Constants that define different types of drawing text attributes.
Name Value
mwDTA_Height 1
mwDTA_Text 2
mwDTA_Font 3
mwDTA_Bold 4
mwDTA_Italic 5
mwDefaultFaceAlignType
Constants that define different types of default face alignments.
Name Value
mwDFA_Center 0
mwDFA_Variable 1
mwApplicationAttributeType
Constants that define different types of application attribute types
Name Value
mwAAT_IniFilePath 1
mwAAT_EnvIniFilePath 2
mwAAT_ClientDirectory 3
mwAAT_BuildNumber 4
mwAAT_AppVersion 5
mwAAT_AppVersionShort 6
mwAAT_AppStreamVersion 7
mwAAT_AppName 8
mwAAT_AppNameDetailed 9
mwAAT_FoundryProcName 10
mwAAT_TestMode 11
Name Value
mwAAT_RegressionCaptureMode 12
mwAAT_ProcessID 13
mwAAT_BuildRevision 14
mwAAT_AppProgId 15
mwAAT_AppAttributeCount 16
mwApplicationDirectoryType
Constants that define different types of application directories.
Name Value
mwADT_AppDir 0
mwADT_AppData 1
mwADT_AppDataUser 2
mwADT_AppDataCommon 3
mwADT_TempFile 4
mwADT_AppDataLogs 5
mwADT_AppDataLibraryCache 6
mwADT_Examples 7
mwADT_Libraries 8
mwADT_EmModels 9
mwADT_Models 10
mwADT_Cells 11
mwADT_Symbols 12
mwADT_Signals 13
mwADT_Textures 14
mwADT_Data 15
mwADT_HSpice 16
mwADT_TestResults 17
mwADT_EmModelsUser 18
mwADT_Logs 19
mwADT_LibraryCache 20
mwADT_Analog 21
mwADT_Projects 22
mwADT_Scripts 23
mwADT_ScriptsUser 24
mwADT_CurrentProject 25
mwADT_Documents 26
Name Value
mwADT_DesignKits 27
mwADT_Measurements 28
mwApplicationFileType
Constants that define different types of application files.
Name Value
mwAFT_Temporary 0
mwAFT_CommonIni 1
mwAFT_UserIni 2
mwAFT_Customizations 3
mwAFT_DataCache 4
mwAFT_FlexLmLicense 5
mwAFT_Executable 6
mwAFT_EMSightCache 7
mwAFT_MWOfficeExe 8
mwAFT_Project 9
mwAFT_GlobalScript 10
mwLayoutCellExportOptions
Constants that define different types of layout cell export options
Name Value
mwLCE_ExportFlattenedOption 0
mwLCE_ExportAsInstancesOption 1
mwLCE_ExportSpecifiedAsInstances 2
mwObjectSelectFilters
Constants that define bits for specific object types for restricting selection
Name Value
mwOSF_None 0
mwOSF_Graphics 1
mwOSF_Equation 2
mwOSF_Text 4
mwOSF_CommonElement 8
mwOSF_Wire 16
mwOSF_Annotation 32
Name Value
mwOSF_iNet 64
mwOSF_MovableProbe 128
mwOSF_LayCell 256
mwOSF_SubCell 512
mwOSF_ParamFrame 1024
mwOSF_BySize 2048
mwOSF_CellPort 4096
mwOSF_AreaPin 8192
mwOSF_LayPort 16384
mwOSF_ByPositionFixed 32768
mwOSF_BySize2 65536
mwOSF_ArtworkCell 131072
mwOSF_EMPort 262144
mwOSF_EMSubCell 524288
mwOSF_LayModifier 1048576
mwOSF_PinObject 28672
mwOSF_InstObject 768
mwLayoutObjectSelectFilters
Constants that define bits for specific object types for restricting selection in layout
Name Value
mwLSF_None 0
mwLSF_Graphics 1
mwLSF_Text 4
mwLSF_iNet 64
mwLSF_LayCell 256
mwLSF_SubCell 512
mwLSF_CellPort 4096
mwLSF_AreaPin 8192
mwLSF_LayPort 16384
mwLSF_ArtworkCell 131072
mwLSF_EMPort 262144
mwLSF_LayModifier 1048576
mwModelPropertyFlags
Constants that define different bits for model flag types.
Name Value
mwEF_Default 0
mwEF_HideName 1
mwEF_NamOnly 2
mwEF_HasNoiseModel 4
mwEF_IsDiodeModel 8
mwEF_IsBipolarModel 16
mwEF_Linear_or_NL 32
mwEF_ConnectToSim 64
mwEF_UseUniqueSim 128
mwEF_AggregateModel 256
mwEF_SpecSampleRate 512
mwEF_IsSysSimModel 1024
mwEF_HideModel 2048
mwEF_UseSimInstId 4096
mwEF_DC_Source 8192
mwEF_MultiBranch 16384
mwEF_NoAddIdInName 32768
mwEF_ExtractBlock 65536
mwEF_DynamicModel 131072
mwEF_IsDynamicRecord 262144
mwEF_ExtractedElement 524288
mwEF_IncludeInTopOnly 1048576
mwEF_AllowDuplicates 2097152
mwEF_ExtractFromSelf 8
mwViewVisiual
Constants that define the different predefined visual modes in a 3D view.
Name Value
mwVV_WireFrame 1
mwVV_Shaded 2
mwVV_ShowEdges 4
mwVV_Texturing 8
mwVV_AntiAliased 16
mwVV_ExtrudedOnly 32
mwVV_ShapesMerged 64
mwVV_ShapesSelected 128
Name Value
mwVV_Stippling 256
mwNetViaSizeOpts
Constants that define different types of iNet route to pin via size options.
Name Value
mwVSO_ViaCoversPinRouteIntersection 0
mwVSO_ViaConversEntirePin 1
mwVSO_ViaMinimalSize 2
mwDefRouteConnModelTypes
Constants that define different types of route-to-route connection models.
Name Value
mwDRCM_CenterlineModel 0
mwDRCM_CenterlineAndAdjacent 1
mwEMPortFlags
Constants that define flags which can be used in the EM port flags field.
Name Value
mwEMF_Default 0
mwEMF_EdgeToGround 1
mwEMF_ExtendUpward 2
mwEMF_ExtendAsMetal 4
mwEMF_ExtendUpDown 8
mwEMF_EndOfTypes 16
mwSmithGridAttributes
Constants that define the different types of attributes for a Smith Chart type Graph.
Name Value
mwSGA_None 0
mwSGA_SmithChartStyle 1
mwSGA_DefaultSweepRange 2
mwSGA_SweepDisplayMin 3
mwSGA_SweepDisplayMax 4
mwSGA_ImpedanceGridVisible 5
Name Value
mwSGA_AdmittanceGridVisible 6
mwSGA_ValuesVisible 7
mwSGA_AutoSize 8
mwSGA_ChartSize 9
mwSGA_AutoContour 10
mwSGA_ContourDensity 11
mwSGA_GraticuleColor 12
mwSGA_ImpedanceColor 13
mwSGA_AdmittanceColor 14
mwSGA_ImpedanceLineStyle 15
mwSGA_AdmittanceLineStyle 16
mwSGA_SweepMinimum 17
mwSGA_SweepMaximum 18
mwPolarGridAttributes
Constants that define the different types of attributes for a Polar Chart type Graph.
Name Value
mwPGA_None 0
mwPGA_PolarChartStyle 1
mwPGA_DefaultSweepRange 2
mwPGA_SweepDisplayMin 3
mwPGA_SweepDisplayMax 4
mwPGA_GraticuleColor 5
mwPGA_MajorDivisionsColor 6
mwPGA_MinorDivisionsColor 7
mwPGA_MagnitudeLineStyle 8
mwPGA_AngleLineStyle 9
mwPGA_MagniAutoDivisions 10
mwPGA_AngleAutoDivisions 11
mwPGA_MagnitudeLimit 12
mwPGA_MagnitudeDivisions 13
mwPGA_MagnitudeSubdivisions 14
mwPGA_MagnitudeMaximum 15
mwPGA_MagnitudeMinimum 16
mwPGA_AngleDivisions 17
mwPGA_AngleSubdivisions 18
Name Value
mwPGA_ShowMagDivisions 19
mwPGA_ShowMagSubdivisions 20
mwPGA_ShowMagValues 21
mwPGA_ShowAngDivisions 22
mwPGA_ShowAngSubdivisions 23
mwPGA_ShowAngValues 24
mwPGA_SweepMinimum 25
mwPGA_SweepMaximum 26
mwRectGridAttributes
Constants that define the different types of attributes for a Rectangular Chart type Graph.
Name Value
mwRGA_None 0
mwRGA_RectChartType 1
mwRGA_GraticuleColor 2
mwRGA_MajorDivisionsColor 3
mwRGA_MinorDivisionsColor 4
mwRGA_XAxisLineStyle 5
mwRGA_LeftYAxisLineStyle 6
mwRGA_RightYAxisLineStyle 7
mwRGA_ShowTickMarks 8
mwRGA_TickMarkSize 9
mwRGA_UseDefaultXLabel 10
mwRGA_DefaultXLabel 11
mwPlot3DGridAttributes
Constants that define the different types of attributes for a 3D Plot type Graph.
Name Value
mwP3A_None 0
mwP3A_AxisGridColorX 1
mwP3A_AxisGridColorY 2
mwP3A_AxisGridColorZ 3
mwP3A_AxisLabelX 4
mwP3A_AxisLabelY 5
mwP3A_AxisLabelZ 6
Name Value
mwP3A_UseAutoDivisionsX 7
mwP3A_UseAutoDivisionsY 8
mwP3A_UseAutoDivisionsZ 9
mwP3A_ManualDivisionsX 10
mwP3A_ManualDivisionsY 11
mwP3A_ManualDivisionsZ 12
mwP3A_AutoDivisionsX 13
mwP3A_AutoDivisionsY 14
mwP3A_AutoDivisionsZ 15
mwP3A_ShowDivisionValuesX 16
mwP3A_ShowDivisionValuesY 17
mwP3A_ShowDivisionValuesZ 18
mwP3A_UseAutoRangeX 19
mwP3A_UseAutoRangeY 20
mwP3A_UseAutoRangeZ 21
mwP3A_ManualRangeMinX 22
mwP3A_ManualRangeMaxX 23
mwP3A_ManualRangeMinY 24
mwP3A_ManualRangeMaxY 25
mwP3A_ManualRangeMinZ 26
mwP3A_ManualRangeMaxZ 27
mwP3A_AutoRangeMinX 28
mwP3A_AutoRangeMaxX 29
mwP3A_AutoRangeMinY 30
mwP3A_AutoRangeMaxY 31
mwP3A_AutoRangeMinZ 32
mwP3A_AutoRangeMaxZ 33
mwP3A_EnableLighting 34
mwP3A_LightPositionX 35
mwP3A_LightPositionY 36
mwP3A_LightPositionZ 37
mwP3A_LightLevelAmbient 38
mwP3A_LightLevelDiffuse 39
mwP3A_LightLevelSpecular 40
mwP3A_LightMaterialAmbient 41
mwP3A_LightMaterialDiffuse 42
mwP3A_LightMaterialSpecular 43
Name Value
mwP3A_LightMaterialShininess 44
mwP3A_LightMaterialEmission 45
mwP3A_UseDefaultLabelX 46
mwP3A_ShowUnitsLabelX 47
mwP3A_UseDefaultLabelY 48
mwP3A_ShowUnitsLabelY 49
mwTabularGridAttributes
Constants that define the different types of attributes for a Tabular Grid type Graph.
Name Value
mwTGA_None 0
mwTGA_NumberFormat 1
mwTGA_DisplayFormat 2
mwTGA_DataPrecision 3
mwTGA_SweepPrecision 4
mwSimStateFlags
Constants that define flags for the different types of simulation dirty states.
Name Value
mwSSF_SimClean 0
mwSSF_SimStructureDirty 1
mwSSF_SimFrequencyDirty 2
mwSSF_ParameterDirty 8
mwSSF_NeedsUpdate 16
mwShowFileFlags
Constants that define flags for the options when displaying a file using the file util ShowFile.
Name Value
mwSFF_USEEXPLORER 16
mwSFF_AUTOUPDATE 32
mwSFF_FILEBUFFER 64
mwShapePreprocessorAttributes
Constants that define the different types of Preprocessor attributes.
Name Value
mwSPA_PreprocessorRules 0
mwBooleanEngineVersions
Constanst that define the different types of boolean engines that can be used for shape processing in layout.
Name Value
mwBEV_BooleanLatest 0
mwBEV_BooleanPolyBool 1
mwBEV_BooleanBoost 2
mwBEV_BooleanClipper 3
mwBooleanCornerStyles
Constanst that define the different types of corner styles that can be used when resizing shapes with acute angles
Name Value
mwBCS_CornerRounded 0
mwBCS_CornerSharp 1
mwWindowState
Constants that define the different window states.
Name Value
mwWS_Maximized 1
mwWS_Minimized 2
mwWS_Normal 3
mwOptimizerSetting
Constants that define the different optimizer settings.
Name Value
mwOS_OptimizerSelected 100
mwOS_MaxIterations 101
mwOS_StopAtMin 102
mwOS_Property 103
mwOS_StopRequested 104
mwOS_ResultsSaved 105
mwOS_ResultsReverted 106
mwOS_ResultsCleared 107
Name Value
mwOS_ResetYield 108
mwOS_StopOnErr 109
mwStatisticalDist
Constants that define different types of statistical distributions.
Name Value
mwSD_Deterministic 0
mwSD_UniformDist 1
mwSD_NormalDist 2
mwSD_ModelDist 3
mwSD_LogNormal 4
mwSD_Discrete 5
mwSD_NormalMinusTol 6
mwSD_NormalClipped 7
mwVarPropMode
Constants that define different types of variable passing down hierarchy
Name Value
mwVPM_None 0
mwVPM_Weak 1
mwVPM_Strong 2
mwEquationVariableType
Constants that define different types of equation variables
Name Value
mwEVT_VariableDefinition 0
mwEVT_ParameterDefinition 1
mwEVT_DisplayValue 2
mwEquationDataType
Constants that define different types of data for equations
Name Value
mwEDT_Real 0
mwEDT_Complex 1
Name Value
mwEDT_Integer 2
mwEDT_String 3
mwEDT_ElementName 4
mwEDT_DataModel 5
mwEDT_InfoString 6
mwEDT_None 7
mwEDT_Enumeration 8
mwEDT_RealVector 9
mwEDT_FileName 10
mwEDT_ComplexVector 11
mwUnitType
Constants that define different types of units.
Name Value
mwUT_None 0
mwUT_Frequency 1
mwUT_Capacitance 2
mwUT_Inductance 3
mwUT_Resistance 4
mwUT_Conductance 5
mwUT_Length 6
mwUT_LengthEnglish 7
mwUT_Temperature 8
mwUT_Angle 9
mwUT_Time 10
mwUT_Voltage 11
mwUT_Current 12
mwUT_PowerLog 13
mwUT_Power 14
mwUT_DB 15
mwUT_String 16
mwUT_Scaler 17
mwUT_DBOnlyPower 18
mwUT_WattsOnlyPower 19
mwUT_TextOnly 20
mwParameterStyle
Constants that define different types of parameter styles.
Name Value
mwPS_Hide 0
mwPS_HideUnits 1
mwPS_HideEmpty 2
mwPS_HideVarName 3
mwPS_LeftJustify 4
mwPS_BoldFont 5
mwPS_HideIfSecondary 6
mwParameterStyleSetting
Constants that define different types of parameter style settings.
Name Value
mwPSS_SetStyle 0
mwPSS_ClearStyle 1
mwPSS_UseDefaultStyle 2
mwParamDefDataType
Constants that define the data types of a ParameterDefinition.
Name Value
mwPDDT_Real 0
mwPDDT_Complex 1
mwPDDT_Integer 2
mwPDDT_String 3
mwPDDT_ElementName 4
mwPDDT_DataModel 5
mwPDDT_InfoString 6
mwPDDT_None 7
mwPDDT_Enumeration 8
mwPDDT_RealVector 9
mwPDDT_FileName 10
mwParameterDefinitionFlagType
Constants that define different types of parameter default flags for parameter definitions.
Name Value
mwPDF_Default 0
mwPDF_Hide 1
mwPDF_HideIfEmpty 2
mwPDF_HideUnits 3
mwPDF_LJustify 4
mwPDF_ReadOnly 5
mwPDF_EmptyStringOk 6
mwPDF_HideVarName 7
mwPDF_BoldFont 8
mwPDF_Secondary 9
mwPDF_IsPortNumber 10
mwPDF_UniqueVectLength 11
mwPDF_NonStructural 12
mwPDF_Structural 13
mwPDF_ReadDataTable 14
mwPDF_ParDefIsCopy 15
mwPDF_ConnectToSim 16
mwPDF_ChangeStructural 17
mwPDF_DynamicModParam 18
mwPDF_StreamParDef 19
mwPDF_ChangeNotDirty 20
mwPDF_NoAffectLayout 21
mwPDF_NoTune 22
mwPDF_Synthesized 23
mwPDF_Binned 24
mwPDF_ChangeConnectivity 25
mwPDF_NoDocNameSync 26
mwPDF_LayCell_EleParam 27
mwNodeType
Constants that define different types of element nodes.
Name Value
mwNT_Electrical 0
mwNT_Input 1
mwNT_Output 2
mwNT_BiDirectional 3
mwNodeDataType
Constants that define different types of node data types.
Name Value
mwNDT_Unset 0
mwNDT_Real 1
mwNDT_Digital 2
mwNDT_Complex 3
mwNDT_FixedPoint 4
mwNodeFlags
Constants that define different types of node flags.
Name Value
mwNF_Default 0
mwNF_Secondary 1
mwNF_BlockBuffer 2
mwNF_ModSignal 4
mwNF_NoDigital 8
mwNF_DispLabel 16
mwNF_RFSignal 32
mwNF_AllowDataTypeChange 64
mwNF_RW_BiDirection 128
mwDisplayModeType
Constants that define the different types of drawing object display modes.
Name Value
mwDMT_Highlighted 1
mwDMT_BuddySelected 2
mwDMT_BuddyUnselected 4
mwDMT_ObjectMarked 8
mwDMT_ObjectCondemned 16
mwPropertyDataType
Constants that define different data types of property objects.
Name Value
mwPDT_Boolean 0
Name Value
mwPDT_Byte 1
mwPDT_Integer 2
mwPDT_Long 3
mwPDT_Single 4
mwPDT_Double 5
mwPDT_Text 6
mwPDT_Date 7
mwShapeType
Constants that define different types of shapes.
Name Value
mwST_Rectangle 0
mwST_Polygon 1
mwST_Path 2
mwST_Ellipse 3
mwST_Text 4
mwST_DrillHole 5
mwST_Port 6
mwST_CellStretcher 7
mwST_Arc 8
mwST_Pin 9
mwST_Polyline 10
mwFillStyle
Constants that define different fill style types.
Name Value
mwFS_None 0
mwFS_Solid 1
mwFS_FineCross 2
mwFS_FineDiagonalCross 3
mwFS_InverseCross 4
mwFS_Checkered 5
mwFS_GridPoint 6
mwFS_InverseFineCross 7
mwFS_FineBackwardDiagonal 8
Name Value
mwFS_FineForwardDiagonal 9
mwFS_FineHorizontal 10
mwFS_HeavyHorizontal 11
mwFS_FineVertical 12
mwFS_HeavyVertical 13
mwFS_MediumHorizontal 14
mwFS_MediumVertical 15
mwFS_CoarseGridPoint 16
mwFS_Brick 17
mwFS_DotCross 18
mwFS_LaceRows 19
mwFS_ForwardDiagonal 20
mwFS_BackwardDiagonal 21
mwFS_Horizontal 22
mwFS_Vertical 23
mwFS_Cross 24
mwFS_DiagonalCross 25
mwLineStyle
Constants that define different line style types.
Name Value
mwLS_Solid 0
mwLS_Dash 1
mwLS_Dot 2
mwLS_DashDot 3
mwLS_DashDotDot 4
mwShapeSubObjectType
Constants that define different types fo shape sub-objects.
Name Value
mwSSO_CutoutPolygon 0
mwSSO_CutoutCircle 1
mwSSO_CutoutEllipse 2
mwShapeArcDirection
Constants that define different arc segment directions.
Name Value
mwSAD_CounterClockwise 0
mwSAD_Clockwise 1
mwPathEndType
Constants that define different types of path ends.
Name Value
mwPET_Various 0
mwPET_ExtendedHalfWidth 1
mwPET_Flush 2
mwPET_Rounded 3
mwPET_ExtendedUserDefined 4
mwPathMiterType
Constants that define different types of path miters.
Name Value
mwPMT_Various 0
mwPMT_Square 1
mwPMT_Mitered 2
mwPMT_OffsetMitered 3
mwPMT_Curved 4
mwPMT_Rounded 5
mwTextAlignment
Constants that define different types of Text alignment.
Name Value
mwTAl_TopLeft 1
mwTAl_TopCenter 2
mwTAl_TopRight 3
mwTAl_CenterLeft 4
mwTAl_CenterCenter 5
mwTAl_CenterRight 6
mwTAl_BottomLeft 7
Name Value
mwTAl_BottomCenter 8
mwTAl_BottomRight 9
mwFaceAlignment
Constants that define different types of face alignments.
Name Value
mwFA_Left 0
mwFA_Center 1
mwFA_Right 2
mwFA_OffsetFix 3
mwFA_OffsetVar 4
mwFA_Adapt 5
mwFaceMultiLayerProperty
Constants that define different types of face multi-layer drawing properties.
Name Value
mwFLP_Default 0
mwFLP_Flush 1
mwFLP_Inside 2
mwFLP_Outside 3
mwFLP_Bridge1 4
mwFLP_Bridge2 5
mwFLP_Bridge3 6
mwFLP_Bridge4 7
mwFaceShapeType
Constants that define different types of face shapes, segment for faces and area for pins
Name Value
mwFST_SegmentFaceType 0
mwFST_AreaFaceType 1
mwFaceGroupType
Constants that define different types of face groups
Name Value
mwFGT_StrongPinGroup 0
mwFGT_WeakPinGroup 1
mwFGT_MustConnectPinGroup 2
mwWindowType
Constants that define the different window types.
Name Value
mwWT_Unknown 0
mwWT_Datafile 1
mwWT_DesignNotes 2
mwWT_EmStructure 3
mwWT_EmStructure3D 4
mwWT_Graph 5
mwWT_NetList 6
mwWT_GlobalEquation 7
mwWT_OutputEquation 8
mwWT_Schematic 9
mwWT_SchematicLayout 10
mwWT_Schematic3DLayout 11
mwWT_SystemDiagram 12
mwWT_SystemDiagramLayout 13
mwWT_SystemDiagram3DLayout 14
mwWT_Optimizer 15
mwWT_LayoutCell 16
mwWT_EmLayoutStructure 17
mwWT_EmLayoutStructure3D 18
mwWT_EmLayoutStructureSchematic 19
mwWT_EmLayoutG3DStructure 20
mwWindowTileDirection
Cosntants that define the different window tile directions.
Name Value
mwWTD_Horizontal 0
mwWTD_Vertical 1
mwDimensionTextLocation
Constants that define different types of text locations for dimension line objects.
Name Value
mwDTL_CenterPar 0
mwDTL_CenterPer 1
mwDTL_RightPar 2
mwDTL_LeftPar 3
mwDimensionArrowLocation
Constants that define different types of arrow locations for dimension line objects.
Name Value
mwDAL_Inside 0
mwDAL_Outside 1
mwLayoutRulerTickLocation
Constants that define different types of layout ruler tick mark locations.
Name Value
mwLRT_AboveRuler -1
mwLRT_BelowRuler 1
mwRouteObjectType
Constants that define different types of route object types
Name Value
mwROT_PathRouteObject 0
mwROT_ViaRouteObject 1
mwROT_GuideRouteObject 2
mwRouteSegmentEndStyleType
Constants that define different route segment end style types
Name Value
mwEST_TruncateEndStyle 0
mwEST_ExtendedEndStyle 1
mwEST_VariableEndStyle 2
mwEST_ChamferEndStyle 3
Name Value
mwEST_CustomEndStyle 4
mwEST_RoundedEndStyle 5
mwRouteViaDirectionType
Constants that define different route via direction types
Name Value
mwVDT_Layer1ToLayer2ViaDirection 0
mwVDT_Layer2ToLayer1ViaDirection 1
mwRouteSegmentEndOffsetType
Constants that define different route segment end offset style types.
Name Value
mwEOS_NormalEndOffsetType 0
mwEOS_FlushEndOffsetType 1
mwEOS_ExtendedEndOffsetType 2
mwDrawingArcDirection
Constants that define different arc segment directions.
Name Value
mwDAD_CounterClockwise 0
mwDAD_Clockwise 1
mwShapeNetType
Constants that define different types of networks for layout shape objects.
Name Value
mwSNT_Normal 0
mwObjectIncludeType
Constants that define the types of objects to be included in an operation.
Name Value
mwOIT_SelectedObjects 0
mwOIT_AllObjects 1
mwDesignRuleType
Constants that define different types of design rule types
Name Value
mwDRT_Width 0
mwDRT_Notch 1
mwDRT_Jog 2
mwDRT_Seperation 3
mwDRT_Extension 4
mwDRT_Overlap 5
mwDRT_ExtensionInv 6
mwDRT_PolygonArea 7
mwDRT_Angle 8
mwDRT_NoHole 9
mwDRT_MustHaveHole 10
mwDRT_OnGrid 11
mwDRT_MaxVertices 12
mwDRT_MaxSideLength 13
mwDRT_ObjectError 14
mwDRT_MultiPolygon 15
mwDRT_Edge 16
mwDRT_Polygon 17
mwDRT_Notch_In 18
mwDRT_Notch_Out 19
mwDRT_Unknown 20
mwDesignRuleState
Constants that define different types of design rule states
Name Value
mwDRS_Error 0
mwDRS_FalseError 1
mwDRS_CheckedError 2
mwDesignRuleErrorFileFormat
Constants that define different types of DRC error file formats.
Name Value
mwDREF_AWR 0
mwDREF_Calibre 1
mwDREF_Assura 2
mwAreaAddType
Constants that define different constraints for adding objects in an area
Name Value
mwAAT_ContainedObjects 0
mwAAT_OverlappedObjects 1
mwDesignViewType
Constants that defined different views on a design
Name Value
mwDVT_DesignView2D 0
mwDVT_DesignView3D 1
mwComponentTestResultType
Constants that define the different types of component test result types.
Name Value
mwDMT_TestRunResultData 0
mwDMT_TestRunPerformanceData 1
mwLayoutSnapType
Constants that define different types of layout snap types.
Name Value
mwLST_AllObjects 0
mwLST_SelectedOnly 1
mwLayoutWindowType
Constants that define the different layout window styles.
Name Value
mwLWT_Layout2D 0
mwLWT_Layout3D 1
mwRouteTopologyType
Constants that define different route topologies
Name Value
mwRTT_NoneRouteTopology 0
mwRTT_StripeRouteTopology 1
mwRTT_StandardCellWireRouteTopology 2
mwRTT_IOWireRouteTopology 3
mwRTT_BlockWireRouteTopology 4
mwRTT_RingRouteTopology 5
mwRTT_PadRingRouteTopology 6
mwRTT_BlockRingRouteTopology 7
mwRTT_CoreWireRouteTopology 8
mwRouteStatusType
Constants that define different route status types
Name Value
mwRST_NormalRouteStatus 0
mwRST_FixedRouteStatus 1
mwRST_LockedRouteStatus 2
mwRouteBendStyleType
Constants that define different types of bend styles for route objects.
Name Value
mwBS_SquareBendStyle 0
mwBS_MiterBendStyle 1
mwBS_CurveBendStyle 2
mwNetViaMode
Constants that define different types of via modes.
Name Value
mwNVM_FullVias 0
mwNVM_MinimalVias 1
mwNVM_ManualVias 2
mwNVM_SemiAutoVias 3
mwNVM_Minimal2Vias 4
mwRouteConnModel
Constants that define different types of route-to-route connection models for a physical net.
Name Value
mwRCM_UseProjectDefault 0
mwRCM_CenterlineConnectionModel 1
mwRCM_CenterLineAndAdjacentModel 2
mwViewFrom
Constants that define the different predefined view from perspectives in a 3D view
Name Value
mwVF_Ortho 0
mwVF_Top 1
mwVF_Front 2
mwVF_Back 3
mwVF_Left 4
mwVF_Right 5
mwVF_Bottom 6
mwVF_None 7
mwViewAutoRotate
Constants that define the different modes for auto rotation within a 3D view.
Name Value
mwVAW_RotateNone 0
mwVAW_RotateNormal 1
mwVAW_RotateChangeSlope 2
mwLVSHighlightLoc
Constants that define where an LVS SchematicHighlight item should be highlighted.
Name Value
mwLVSHL_NoHighlighting 0
mwLVSHL_HighlightInSchematic 1
mwLVSHL_HighlightInLayout 2
mwLVSHL_HighlightInSchemAndLay 3
mwShapeModifierType
Constants that define the different types of shape modifiers.
Name Value
mwMD_ShapeModifier 0
mwMD_GlobalModifier 1
mwShapeModifierPriority
Constants that define the different types of modifier priority levels.
Name Value
mwSMP_NormalShape 1
mwSMP_FlattenShape 2
mwSMP_GlobalModifier 3
mwSMP_ShapeProcessor 4
mwEMPortType
Constants that define the different types of EM ports.
Name Value
mwEMP_None 1
mwEMP_Left 2
mwEMP_Bottom 3
mwEMP_Right 4
mwEMP_Top 5
mwEMP_CenterX 6
mwEMP_CenterY 7
mwEMP_Via 8
mwEMP_GapX 9
mwEMP_GapY 10
mwEMP_FullLine 11
mwEMP_HalfLine 12
mwEMP_Extract 13
mwEMGroupType
Constants that define the different types of EM port group types.
Name Value
mwEMG_None 0
Name Value
mwEMG_NoneOld 1
mwEMG_Series 2
mwEMG_Mutual 3
mwEMG_Coupled 4
mwEMShapePortType
Constants that define the different types of EM shape port types.
Name Value
mwSPT_EdgePort 1
mwSPT_InternalPort 2
mwSPT_ViaPort 3
mwSPT_ExtractPort 4
mwPlacementJustfication
Constants that define the different types of placement justification styles.
Name Value
mwPJ_BBoxCenter 0
mwPJ_BBoxUpperLeft 1
mwPJ_BBoxLowerLeft 2
mwPJ_BBoxUpperRight 3
mwPJ_BBoxLowerRight 4
mwPJ_SameOrigin 5
mwUnionShapesType
Constanst that define the different types of shape union types.
Name Value
mwUST_UnionOnExistingLayers 0
mwUST_UnionToDestinationLayer 1
mwIntersectShapesType
Constants that define the different types of shape intersection types.
Name Value
mwIST_IntersectOnExistingLayers 0
mwIST_IntersectToDestinationLayer 1
mwExclusiveOrShapesType
Constants that define the different types of shape exclusive or types.
Name Value
mwEST_ExclusiveOrOnExistingLayers 0
mwEST_ExclusiveOrOnDestinationLayer 1
mwCellExportFormat
Constants that define different types of cell export formats.
Name Value
mwCEF_GDSII 0
mwCEF_DXF 1
mwLayoutParamDataType
Constants that define the data types of a LayoutParameter.
Name Value
mwLPDT_Real 0
mwLPDT_Integer 1
mwLPDT_String 2
mwLPDT_RealVector 3
mwLPDT_IntVector 4
mwDrawingSubObjectType
Constants that define differnet types of drawing sub-objects.
Name Value
mwDSO_CutoutPolygon 0
mwDSO_CutoutCircle 1
mwDSO_CutoutEllipse 2
mwElementType
Constants that define different types of elements.
Name Value
mwET_Circuit 0
mwET_System 1
mwSubcktGroundType
Constants that define different types of sub-circuit grounding.
Name Value
mwSG_Normal 0
mwSG_Explicit 1
mwSG_Balanced 2
mwModelParseType
Constants that define different types of model parse types.
Name Value
mwMPT_Unknown 0
mwMPT_AWRNet 1
mwMPT_AWRModel 2
mwMPT_LibraModel 3
mwMPT_MWHarmModel 4
mwMPT_HSPICE_trans 5
mwMPT_HSPICE_native 6
mwMPT_PSpice 7
mwMPT_Touchstone 8
mwMPT_MMICAD 9
mwSchematicExportFormat
Constants that define different types of schematic export formats.
Name Value
mwSEF_MWOSchematicFile 0
mwSchematicNetlistExportFormat
Constants that define different types of schematic netlist export formats.
Name Value
mwNEF_MWONetlistFile 0
mwDrawingShapeType
Constants that define different types of drawing shape objects.
Name Value
mwDST_Unknown 0
mwDST_Line 1
mwDST_Arc 2
mwDST_Polygon 3
mwDST_Polyline 4
mwDST_Text 5
mwDST_Ellipse 6
mwDST_Rectangle 7
mwDST_Arrow 8
mwDiagramLockLevel
Constants that define different types of lock levels for schematic and system diagrams
Name Value
mwDLL_Unlocked 0
mwDLL_LockedForEdit 1
mwDLL_LockedForViewing 2
mwEmbeddedDocType
Values that define different embedded document types.
Name Value
mwEDT_Unknown 0
mwEDT_Schematic 1
mwEDT_SchematicLayout 2
mwEDT_SchematicLayout3D 3
mwEDT_EMLayout 4
mwEDT_EMLayout3D 5
mwEDT_SystemDiagram 6
mwEDT_Graph 7
mwSystemExportFormat
Constants that define different types of system export formats.
Name Value
mwSYF_MWOSystemFile 0
mwHatchStyle
Constants that define different types of Hatch fill styles.
Name Value
mwHS_None 0
mwHS_Solid 1
mwHS_Horizontal 2
mwHS_Vertical 3
mwHS_ForwardDiagonal 4
mwHS_BackwardDiagonal 5
mwHS_Cross 6
mwHS_DiagonalCross 7
mwBoundaryModelType
Constants that define different types of boundary models.
Name Value
mwBMT_PerfectConductor 0
mwBMT_SpecifiedMaterial 1
mwBMT_ApproximateOpen 2
mwBMT_InfiniteWaveguide 3
mwBMT_ReadConductor 4
mwBMT_Dielectric 5
mwEmSimulator
Constants that define the different types of electromagnetic simulators.
Name Value
mwEMS_AwrAxiem 0
mwEMS_AwrAxiem32 1
mwEMS_AwrAxiem64 2
mwEMS_AwrEmSight 3
mwEMS_AwrAnalyst 4
mwEMS_AwrAce 5
mwEMS_SonnetEm 6
mwEMS_ZelandIe3d 7
mwEMS_OeaNetan 8
mwEMS_CST 9
Name Value
mwEMS_HFSSAsync 10
mwEMS_CSTAsync 11
mwEMS_SonnetAsync 12
mwEMInputDataXMLType
Constants that define the different types of XML Input Data formats.
Name Value
mwEIX_EMSocketDataFile 0
mwEIX_EMSocketSimplifiedDataFile 1
mwGraphType
Constants that define different types of graphs.
Name Value
mwGT_Polar 1
mwGT_SmithChart 2
mwGT_Rectangular 3
mwGT_Tabular 4
mwGT_Antenna 5
mwGT_Histogram 6
mwGT_ThreeDim 7
mwGT_Constellation 8
mwMeasDataType
Constants that define different measurement data types.
Name Value
mwMDT_UnKnown 0
mwMDT_ReflectionData 1
mwMDT_AdmittanceData 2
mwMDT_ImpedanceData 3
mwMDT_GainCircleData 4
mwMDT_NoiseData 5
mwMDT_StabilityData 6
mwMDT_CurveTraceData 7
mwMDT_SpectrumData 8
mwMDT_SourceMapData 9
Name Value
mwMDT_HistogramData 10
mwMDT_MultiTraceData 11
mwMDT_LoadPullContour 12
mwMDT_DiscreteTimeData 13
mwThickness
Constants that define the thickness of a line or trace.
Name Value
mwHairline 1
mwThin 2
mwMedium 3
mwThick 4
mwFat 5
mwScaleType
Constants that define the type of scale of an Axis object.
Name Value
mwScaleLinear 1
mwScaleLogarithmic 2
mwDashStyle
Constants that define the dash styles of a line.
Name Value
mwLineSolid 1
mwLineThick 2
mwLineThin 3
mwLineThickThin 4
mwTraceSymbols
Constants that define the different symbols for traces objects.
Name Value
mwSymbolTriangle 1
mwSymbolSquare 2
mwSymbolDiamond 3
Name Value
mwSymbolRomanX 4
mwSymbolHorizontalBar 5
mwSymbolVerticalBar 6
mwSymbolForwardSlash 7
mwSymbolBackSlash 8
mwSymbolArrow 9
mwSymbolCircle 10
mwSymbolSmallX 11
mwSymbolCross 12
mwPlotAxis
Constants that define different axes for plotting.
Name Value
mwPA_Left 0
mwPA_Right 1
mwTraceStyle
Constants that define different styles for a graph trace object.
Name Value
mwTraceStyleAuto 1
mwTraceStyleLinear 2
mwTraceStyleScatter 3
mwTraceStyleSpectral 4
mwTraceStyleHistogram 5
mwTraceStyleDigital 6
mwTraceStyleSampled 7
mwTraceStyleVariationBars 8
mwTraceSteppedColorStyle
Constants that define different stepped color styles for a graph trace object.
Name Value
mwSteppedColorStyleNone 1
mwSteppedColorStyleStepped 2
mwSteppedColorStyleGradient 3
mwSteppedColorStyleGradientRed 4
Name Value
mwSteppedColorStyleGradientGreen 5
mwSteppedColorStyleGradientBlue 6
mwSteppedColorStyleShaded 7
mwMarkerSearchMode
Constants that define different search modes for markers.
Name Value
mwMST_Absolute 0
mwMST_Delta 1
mwMarkerSearchDirection
Constants that define different search directions for markers.
Name Value
mwMSD_SearchRight 0
mwMSD_SearchLeft 1
mwMarkerSearchVariable
Constants that define different search variable types for markers.
Name Value
mwMSV_X 0
mwMSV_Y 1
mwMarkerType
Constants that define different types of graph markers.
Name Value
mwMT_Normal 0
mwMT_Parameter 1
mwMT_DataSet 2
mwMT_AutoSearch 3
mwMT_Offset 4
mwMarkerAutoSearchMode
Constants that define different auto-search marker modes.
Name Value
mwMAM_Max 0
mwMAM_Min 1
mwMAM_Peak 2
mwMAM_Valley 3
mwMAM_Value 4
mwMAM_XIndex 5
mwMarkerOffsetMode
Constants that define different offset marker modes.
Name Value
mwMOM_X 0
mwMOM_Y 1
mwMarkerSymbolType
Constants that define different types of marker symbols.
Name Value
mwMST_None 0
mwMST_TriangleUp 1
mwMST_Rectangle 2
mwMST_Diamond 3
mwMST_HourGlass 4
mwMST_LineHorizontal 5
mwMST_LineVertical 6
mwMST_LineUpDiagonal 7
mwMST_LineDownDiagonal 8
mwMST_TriangleDown 9
mwMST_Circle 10
mwMST_Cross 11
mwMST_Plus 12
mwGraphMarkerType
Constants that define different output data types for graph cursors and markers.
Name Value
mwGMT_ReflectionCoefficient 0
mwGMT_Impdedence 1
Name Value
mwGMT_Admittance 2
mwGMT_Unknown 3
mwGraphMarkerFormat
Constants that define different output formats for graph cursors and markers.
Name Value
mwGMF_RealImaginary 0
mwGMF_MagnitudeAngle 1
mwGMF_DbMagnitudeAngle 2
mwPrecisionMode
Constants that define the different types of precision display modes.
Name Value
mwPM_Auto 1
mwPM_Manual 2
mwPrecisionStyle
Constants that define the different types of precision display styles.
Name Value
mwPS_FixedSigFigures 1
mwPS_FixedRightDecimal 2
mwPS_Scientific 3
mwLineMarkerType
Constants that define different types of LineMarker objects.
Name Value
mwLM_HorizontalLineMarker 1
mwLM_VerticalLineMarker 2
mwLineMarkerTrackType
Constants that define different types of LineMarker track types.
Name Value
mwLMT_XAxis 1
mwLMT_LeftYAxis 2
Name Value
mwLMT_RightYAxis 3
mwDataFileType
Constants that define different types of data files.
Name Value
mwDFT_SNP 0
mwDFT_RAW 1
mwDFT_IV 2
mwDFT_TXT 3
mwDFT_MDIF 4
mwDFT_GMDIF 5
mwDFT_DSCR 6
mwDFT_GMDIFD 7
mwCellLibraryType
Constants that define the different cell library types.
Name Value
mwCLT_GDSII 0
mwCLT_DXF 1
mwCLT_OA 2
mwOptGoalType
Constants that define different types of optimization goals.
Name Value
mwOGT_Equals 0
mwOGT_LessThan 1
mwOGT_GreaterThan 2
mwLayoutExportFormat
Constants that define different types of layout export formats.
Name Value
mwLEF_GDSII_Hierarchical 0
mwLEF_GDSII_Flat 1
mwLEF_DXF 2
Name Value
mwLEF_Gerber 3
mwLEF_DrillFile 4
mwLEF_Pads 5
mwViaSpacingType
Constants that define the different types of via spacings for via fill entries and via fence entries.
Name Value
mwVST_CenterToCenter 0
mwVST_EdgeToEdge 1
mwViaFillStaggerMode
Constants that define the different types of via stagger mode for via fill entries.
Name Value
mwVSM_StaggerNone 0
mwVSM_StaggerRows 1
mwVSM_StaggerColumns 2
mwViaAlignType
Constants that define the different types of via alignments for via fill entries.
Name Value
mwVAT_ConstantSpacing 0
mwVAT_ConstantClearance 1
mwNetlistType
Constants that define different types of netlists.
Name Value
mwNLT_AWR 0
mwNLT_SPICE 1
mwNLT_PSPICE 1
mwNLT_TSTONE 2
mwNLT_Touchstone 2
mwNLT_HSPICE 3
mwNLT_HSPICE_NATIVE 4
mwNLT_Native_HSPICE 4
Name Value
mwNLT_Native_APLAC 7
mwNLT_Spectre 8
mwNLT_HSPICE2 10
mwYieldGoalType
Constants that define different types of yield goals.
Name Value
mwYGT_LessThan 0
mwYGT_GreaterThan 1
mwSymbolShapeType
Constants that define different types of symbol shapes.
Name Value
mwSST_Line 0
mwSST_Arc 1
mwSST_Polygon 2
mwSST_Path 3
mwSST_Text 4
mwSST_Ellipse 5
mwSST_Node 6
mwSST_Polyline 7
mwSST_MetaText 8
mwSymbolType
Constants that define different types of symbol categories like project or system symbols
Name Value
mwST_SystemSymbolType 0
mwST_ProjectSymbolType 1
mwSymbolSelectMode
Constants that define different types of symbol select modes.
Name Value
mwSM_NormalSelect 0
mwSM_EdgeSelect 1
mwUnitMultType
Constants that define different types of multipliers.
Name Value
mwUMT_f 0
mwUMT_p 1
mwUMT_n 2
mwUMT_u 3
mwUMT_m 4
mwUMT_c 5
mwUMT_none 6
mwUMT_k 7
mwUMT_Mega 8
mwUMT_Giga 9
mwUMT_Tera 10
mwUMT_mil 11
mwUMT_inch 12
mwUMT_feet 13
mwUMT_mile 14
mwUMT_DegC 15
mwUMT_DegK 16
mwUMT_DegF 17
mwUMT_Rad 18
mwUMT_Deg 19
mwUMT_dbm 20
mwUMT_dbw 21
mwErrorType
Constants that define different types of errors.
Name Value
mwET_None 0
mwET_Warning 1
mwET_Error 2
mwET_Fatal 3
mwEMInitType
Constants that define the different types of EMStructure initialization types.
Name Value
mwEMI_Stackup 0
mwEMI_LPF 1
mwEMI_Default 2
mwModelPriorityType
Constants that define different types of priorities for Model objects.
Name Value
mwMPT_UNINIT 0
mwMPT_ALL 1
mwMPT_WIRE 2
mwMPT_LINEAR 3
mwMPT_TUNEOPT 4
mwMPT_MEAS 5
mwMPT_NONLINEAR 6
mwMPT_SOURCE 7
mwMPT_IO 8
mwMPT_GROUND 9
mwMPT_ISOLATED 10
mwMPT_SINK 11
mwLibraryElementType
Constants that define the different types of library elements.
Name Value
mwLET_Unknown 0
mwLET_Model 1
mwLET_XML 2
mwLET_DataFile 3
mwLET_Subcircuit 4
mwDockBorder
Constants that define the locations that a window can be docked to.
Name Value
mwDB_Top 1
mwDB_Bottom 2
mwDB_Left 3
Name Value
mwDB_Right 4
mwDockState
Constants that define the different dockable states of a window.
Name Value
mwDS_Docked 1
mwDS_Floating 2
mwDS_Normal 3
mwStatusItemCategory
Constants that define the category of a status item.
Name Value
mwRIC_Error 0
mwRIC_Warning 1
mwRIC_Info 2
mwJobStatusType
Constants that define the different types of job status states for JobProcess objects.
Name Value
mwJS_Unknown 0
mwJS_Rejected 1
mwJS_Pending 2
mwJS_Scheduled 3
mwJS_Removed 4
mwJS_Running 5
mwJS_Suspended 6
mwJS_Canceling 7
mwJS_Ended 8
mwJS_Canceled 9
mwJS_Killed 10
mwJS_Crashed 11
mwJS_Failed 12
mwJS_Sending 13
mwJS_Receiving 14
mwShowFileType
Constants that define the different types of files that can be displayed by the file utility ShowFile.
Name Value
mwSFT_PlainText 0
mwSFT_RichText 1
mwPageSetupOrientation
Constants that define the different types of page orientations.
Name Value
mwPSO_Portrait 0
mwPSO_Landscape 1
mwPageSetupDetailLevel
Constants that define the diffeent levels of output detail.
Name Value
mwPSD_MaximumVisability 0
mwPSD_MinimumComplexity 1
mwPrintPaperSize
Constants that define the different sizes of paper for printing.
Name Value
mwPPS_Letter 0
mwPPS_LetterSmall 1
mwPPS_Tabloid 2
mwPPS_Ledger 3
mwPPS_Legal 4
mwPPS_Statement 5
mwPPS_Executive 6
mwPPS_A3 7
mwPPS_A4 8
mwPPS_A4_SMALL 9
mwPPS_A5 10
mwPPS_B4 11
mwPPS_B5 12
mwPPS_Folio 13
Name Value
mwPPS_Quarto 14
mwPPS_10X14 15
mwPPS_11X17 16
mwPPS_Note 17
mwPPS_Env_9 18
mwPPS_Env_10 19
mwPPS_Env_11 20
mwPPS_Env_12 21
mwPPS_Env_14 22
mwPPS_CSheet 23
mwPPS_DSheet 24
mwPPS_ESheet 25
mwPPS_Env_DL 26
mwPPS_Env_C5 27
mwPPS_Env_C3 28
mwPPS_Env_C4 29
mwPPS_Env_C6 30
mwPPS_Env_C65 31
mwPPS_Env_B4 32
mwPPS_Env_B5 33
mwPPS_Env_B6 34
mwPPS_Env_Italy 35
mwPPS_Env_Monarch 36
mwPPS_Env_Personal 37
mwPPS_Fanfold_US 38
mwPPS_Fanfold_Std_German 39
mwPPS_Fanfold_Lgl_German 40
mwPPS_ISO_B4 41
mwPPS_Japanese_Postcard 42
mwPPS_9X11 43
mwPPS_10X11 44
mwPPS_15X11 45
mwPPS_Env_Invite 46
mwPPS_Letter_Extra 47
mwPPS_Legal_Extra 48
mwPPS_Tabloid_Extra 49
mwPPS_A4_Extra 50
Name Value
mwPPS_Letter_Transverse 51
mwPPS_A4_Transverse 52
mwPPS_Letter_Extra_Transverse 53
mwPPS_A_Plus 54
mwPPS_B_Plus 55
mwPPS_Letter_Plus 56
mwPPS_A4_Plus 57
mwPPS_A5_Transverse 58
mwPPS_B5_Transverse 59
mwPPS_A3_Extra 60
mwPPS_A5_Extra 61
mwPPS_B5_Extra 62
mwPPS_A2 63
mwPPS_A3_Transverse 64
mwPPS_A3_Extra_Transverse 65
mwPPS_Dbl_Japanese_Postcard 66
mwPPS_A6 67
mwPPS_JEnv_KAKU2 68
mwPPS_JEnv_KAKU3 69
mwPPS_JEnv_CHOU3 70
mwPPS_JEnv_CHOU4 71
mwPPS_Letter_Rotated 72
mwPPS_A3_Rotated 73
mwPPS_A4_Rotated 74
mwPPS_A5_Rotated 75
mwPPS_B4_JIS_Rotated 76
mwPPS_B5_JIS_Rotated 77
mwPPS_Japanese_Postcard_Rotated 78
mwPPS_Dbl_Japanese_Postcard_Rotated 79
mwPPS_A6_Rotated 80
mwPPS_JEnv_KAKU2_Rotated 81
mwPPS_JEnv_KAKU3_Rotated 82
mwPPS_JEnv_CHOU3_Rotated 83
mwPPS_JEnv_CHOU4_Rotated 84
mwPPS_B6_JIS 85
mwPPS_B6_JIS_Rotated 86
mwPPS_12X11 87
Name Value
mwPPS_JEnv_YOU4 88
mwPPS_JEnv_YOU4_Rotated 89
mwPPS_P16K 90
mwPPS_P32K 91
mwPPS_P32KBIG 92
mwPPS_PEnv_1 93
mwPPS_PEnv_2 94
mwPPS_PEnv_3 95
mwPPS_PEnv_4 96
mwPPS_PEnv_5 97
mwPPS_PEnv_6 98
mwPPS_PEnv_7 99
mwPPS_PEnv_8 100
mwPPS_PEnv_9 101
mwPPS_PEnv_10 102
mwPPS_P16K_Rotated 103
mwPPS_P32K_Rotated 104
mwPPS_P32KBig_Rotated 105
mwPPS_PEnv_1_Rotated 106
mwPPS_PEnv_2_Rotated 107
mwPPS_PEnv_3_Rotated 108
mwPPS_PEnv_4_Rotated 109
mwPPS_PEnv_5_Rotated 110
mwPPS_PEnv_6_Rotated 111
mwPPS_PEnv_7_Rotated 112
mwPPS_PEnv_8_Rotated 113
mwPPS_PEnv_9_Rotated 114
mwPPS_PEnv_10_Rotated 115
mwPrintPaperSource
Constants that define the different sources of paper for printing
Name Value
mwPSR_Upper 0
mwPSR_OnlyOne 1
mwPSR_Lower 2
mwPSR_Middle 3
Name Value
mwPSR_Manual 4
mwPSR_Evelope 5
mwPSR_EnvManual 6
mwPSR_Auto 7
mwPSR_Tractor 8
mwPSR_SmallFmt 9
mwPSR_LargeFmt 10
mwPSR_LargeCapacity 11
mwPSR_FormSource 12
mwPSR_User 13
mwSystemSimulatorState
Constants that define different types of simulator run states
Name Value
mwSSS_Stopped 0
mwSSS_Running 1
mwSSS_Paused 2
mwSSS_Starting 3
mwProjectVersionType
Constants that define different types of project version values.
Name Value
mwPV_Latest 1
mwPV_Previous 2
mwPV_VersionNumber 3
mwProjectItemType
Constants that define the different types of project items.
Name Value
mwPIT_Schematic 0
mwPIT_SystemDiagram 1
mwPIT_EMStructure 2
mwPIT_Netlist 3
mwPIT_DataFile 4
mwPIT_Graph 5
Name Value
mwPIT_Annotation 6
mwPIT_Measurement 7
mwPIT_OptimizerGoal 8
mwPIT_YieldGoal 9
mwPIT_OutputFile 10
mwPIT_DesignNotes 11
mwPIT_GlobalDefinitions 12
mwPIT_OutputEquations 13
mwPIT_Wizard 14
mwPIT_WizardInstance 15
mwPIT_Other 16
mwPIT_SampleProjectItem 17
mwPIT_DataSetFolder 18
mwPIT_DataSet 19
mwProjectTemplateType
Constants that define different types of project template type values.
Name Value
mwPT_NormalTemplate 1
mwDataSetFlags
Constants that define flag types associated with data sets.
Name Value
mwDSF_Default 0
mwDSF_IsPartialDataSet 1
mwDSF_MeshOnly 2
mwDSF_NotFinalIter 4
mwDSF_PortOnly 8
mwDSF_IncludesGeometry 16
mwDSF_ForOptimization 32
mwDSF_IncludesG3DModel 64
mwDSF_KeepSweepValOrder 128
mwDSF_NoAutoLoadInProject 256
mwDSF_KeepWriteStreamOpen 512
mwDSF_IncompleteDataSet 1024
Name Value
mwDSF_KeepReadStreamOpen 2048
mwDSF_DocCleanOnOpen 4096
mwDSF_Pinned 8192
mwDSF_Updating 16384
mwDSF_DisableAutoDelete 32768
mwDSF_ForTuning 65536
mwDSF_ForYield 131072
mwDSF_ClockStringReset 262144
mwDSF_DistSimResult 524288
mwDSF_InMemoryDataSet 1048576
mwExternalEditorType
Constants that define the different types of external editors for EM3DStructure objects.
Name Value
mwEET_SpaceClaimEditor 1
mwEET_OrionEditor 2
mwEECmdShow
Constants that define the different types of external editor show states.
Name Value
mwEECS_Hide 0
mwEECS_Show 1
C
Code modules, 18
COM automation API, 11
M
Modules
code, 18
object, 18
O
Object modules, 18
S
scripting, 11
Scripts
importing, 15
running, 16
SDE, 11