Anda di halaman 1dari 142

Common Automation Reference

Release PADS VX.2.1

2011-2016 Mentor Graphics Corporation


All rights reserved.

This document contains information that is proprietary to Mentor Graphics Corporation. The original recipient of this
document may duplicate this document in whole or in part for internal business purposes only, provided that this entire
notice appears in all copies. In duplicating any part of this document, the recipient agrees to make every reasonable
effort to prevent the unauthorized use and distribution of the proprietary information.
This document is for information and instruction purposes. Mentor Graphics reserves the right to make
changes in specifications and other information contained in this publication without prior notice, and the
reader should, in all cases, consult Mentor Graphics to determine whether any changes have been
made.

The terms and conditions governing the sale and licensing of Mentor Graphics products are set forth in
written agreements between Mentor Graphics and its customers. No representation or other affirmation
of fact contained in this publication shall be deemed to be a warranty or give rise to any liability of Mentor
Graphics whatsoever.

MENTOR GRAPHICS MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE.

MENTOR GRAPHICS SHALL NOT BE LIABLE FOR ANY INCIDENTAL, INDIRECT, SPECIAL, OR
CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS)
ARISING OUT OF OR RELATED TO THIS PUBLICATION OR THE INFORMATION CONTAINED IN IT,
EVEN IF MENTOR GRAPHICS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

U.S. GOVERNMENT LICENSE RIGHTS: The software and documentation were developed entirely at
private expense and are commercial computer software and commercial computer software
documentation within the meaning of the applicable acquisition regulations. Accordingly, pursuant to
FAR 48 CFR 12.212 and DFARS 48 CFR 227.7202, use, duplication and disclosure by or for the U.S.
Government or a U.S. Government subcontractor is subject solely to the terms and conditions set forth in
the license agreement provided with the software, except for provisions which are contrary to applicable
mandatory federal laws.

TRADEMARKS: The trademarks, logos and service marks ("Marks") used herein are the property of
Mentor Graphics Corporation or other parties. No one is permitted to use these Marks without the prior
written consent of Mentor Graphics or the owner of the Mark, as applicable. The use herein of a third-
party Mark is not an attempt to indicate Mentor Graphics as a source of a product, but is intended to
indicate a product from, or associated with, a particular third party. A current list of Mentor Graphics
trademarks may be viewed at: www.mentor.com/trademarks.

The registered trademark Linux is used pursuant to a sublicense from LMI, the exclusive licensee of
Linus Torvalds, owner of the mark on a world-wide basis.

Mentor Graphics Corporation


8005 S.W. Boeckman Road, Wilsonville, Oregon 97070-7777
Telephone: 503.685.7000
Toll-Free Telephone: 800.592.2210
Website: www.mentor.com
SupportNet: supportnet.mentor.com/

Send Feedback on Documentation: supportnet.mentor.com/doc_feedback_form


Table of Contents

Chapter 1
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Chapter 2
Scripting With Multiple Installs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Identifying the COM Version Number of an Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
COM Version Script Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
ReleaseEnvServer Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
GetInstalledReleases Method (ReleaseEnvServer Object). . . . . . . . . . . . . . . . . . . . . . . . . 15
SetEnvironment Method (ReleaseEnvServer Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
ProgIDVersion Property (ReleaseEnvServer Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
sddHome Property (ReleaseEnvServer Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
sddPlatform Property (ReleaseEnvServer Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
sddVersion Property (ReleaseEnvServer Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Release Environment Server Enumerated Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
EReleaseEnvErrCode Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Chapter 3
Scripting Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Scripting Object Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Program IDs for Applications and Automation Engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Scripting Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
AddTypeLibrary Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
AttachEvents Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
CreateObject Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
ExpandEnvironmentStrings Method (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . 32
GetEnvVariable Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
SetEnvVariable Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Sleep Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
DontExit Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Globals Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
IsUnix Property (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
OSName Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
OSVersion Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Struct Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Count Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Data Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Item Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Keys Property (Struct Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Common Automation Reference, PADS VX.2.1 3


Table of Contents

Chapter 4
CommandBar Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
CommandBarServer Data Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
CommandBar Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Controls Property (CommandBar Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
CommandBarButton Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Delete Method (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
BitmapFile Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
BitmapResource Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . 55
Caption Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
DescriptionText Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Enabled Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
ExecuteMethod Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Id Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
OnAction Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ResourceDLL Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Target Property (CommandBarButton Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
TooltipText Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
UpdateMethod Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
CommandBarControl Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Delete Method (CommandBarControl Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Caption Property (CommandBarControl Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
CommandBarPopup Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Delete Method (CommandBarPopup Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Caption Property (CommandBarPopup Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Controls Property (CommandBarPopup Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
CommandBarControls Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Add Method (CommandBarControls Collection). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Count Property (CommandBarControls Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Item Property (CommandBarControls Collection). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
CommandBars Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Item Property (CommandBars Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Command Bar Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
CmdControlType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Chapter 5
KeyBind Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
KeyBindServer Data Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
KeyBinding Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Command Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
ExecuteMethod Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Id Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Key Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
KeyType Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Target Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Type Property (KeyBinding Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
VirtualKey Property (KeyBinding Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
BindingTables Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

4 Common Automation Reference, PADS VX.2.1


Table of Contents

AddKeyBinding Method (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95


AddStrokeBinding Method (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Bindings Property (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Item Property (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
KeyBindings Collection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Remove Method (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Count Property (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Item Property (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Key Binding Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
BindKeyType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
BindType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

Chapter 6
Addin Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Addin Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Active Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Control Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
ClassID Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Description Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
DisplayName Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Group Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Name Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Placement Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
ProgID Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
ShortCutKey Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Visible Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Width Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
MGCAddins Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Add Method (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Remove Method (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Count Property (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Item Property (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Addins Enumerated Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
PlacementLocation Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Chapter 7
JScriptHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
JScriptHelper Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
ToScriptArray Method (JScriptHelper Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Nothing Property (JScriptHelper Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
JScriptHelper Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Third-Party Information
End-User License Agreement

Common Automation Reference, PADS VX.2.1 5


Table of Contents

6 Common Automation Reference, PADS VX.2.1


Chapter 1
Introduction

This document provides reference information about servers that are common to multiple
Mentor Graphics applications. This information is useful for anyone seeking to develop
automation scripts for use with xPCB Layout, xDX Designer, xDM Library Tools, or other
Mentor Graphics tools.
The servers described in this document are:

The ReleaseEnvServer object, which enables you to manage scripts on machines that
have multiple PCB software installs. See Scripting With Multiple Installs.
Scripting Object server, which is available to all applications. That is, you do not need
any special calls in your script to include this server.
The CommandBar Server, which allows you to customize the toolbars and menus of
applications.
The KeyBind Server, which allows you to define custom shortcut or key accelerators for
applications.
The Addin Controls, which allows you to include and run add-ins in the applications.
The JScriptHelper, which is available to all applications. That is, you do not need any
special calls in your script to include this server.

Common Automation Reference, PADS VX.2.1 7


Introduction

8 Common Automation Reference, PADS VX.2.1


Chapter 2
Scripting With Multiple Installs

You can develop and run scripts on a machine with multiple Mentor PCB releases installed. To
determine which install the script calls, you include a COM version number when you create
application instances in your scripts. With more complex scripts, you can query the installed
releases on a machine and perform different actions based on the environment.
Note
If you do not include COM version numbers in your scripts, the version defaults to the last
software install tree.

Topic Description
Identifying the COM Version To use Mentor automation in a design environment
Number of an Install where multiple software installs/releases exist on the
same machine, you must know the COM version
number for each of the installs.
COM Version Script Examples VBScript examples show you how to manage scripts
on systems that have multiple Mentor PCB software
installs.
ReleaseEnvServer Object The ReleaseEnvServer object provides access to the
PCB software install environment. The COM version
of this object does not change.

Identifying the COM Version Number of an


Install
To use Mentor automation in a design environment where multiple software installs/releases
exist on the same machine, you must know the COM version number for each of the installs.
You can also automate the process of identifying the COM Version number using methods in
the ReleaseEnvServer Object.

Common Automation Reference, PADS VX.2.1 9


Scripting With Multiple Installs
Identifying the COM Version Number of an Install

Procedure
Use any of the following methods to determine the COM Version Number:

If you want to... Do the following...


View the COMVersion.xml 1. In a text editor, open <install>/SDD_HOME/standard/
file COMVersion.xml
2. Search for PROG_ID_VER
The <data> element contains the COM version number.
Example:
<var>
<name>PROG_ID_VER</name>
<data>3</data>
<append>replace</append>
</var>

1. Repeat these steps for each install.


Run ReleaseReader 1. Do one of the following, based on your operating system.
command Windows 7Choose Start > release_name > Administrative
Tools > MGC PCB Command Window VX1.
Note: You can also type mgcmd in the Start menus search
box.
Windows 8In the Apps view, under release_name >
Administrative Tools, click MGC PCB Command Window
VX.1.
Note: You can also type mgcmd in the Start screen to invoke
the search app.
2. In the command window, type ReleaseReader.
The output lists each COM_VERSION variable on the machine.
Example:

[HKLM32_MGC_4]
SDD_VERSION: PADSProVX.1
SDD_HOME:
C:\MentorGraphics\PADSProVX.1\SDD_HOME
SDD_PLATFORM: win32
COM_VERSION: 3

[HKCU_MGC_2]
SDD_VERSION: EEVX.1
SDD_HOME: C:\MentorGraphics\EEVX.1\SDD_HOME
SDD_PLATFORM: win32
COM_VERSION: 9

Related Topics
COM Version Script Examples

10 Common Automation Reference, PADS VX.2.1


Scripting With Multiple Installs
COM Version Script Examples

ReleaseEnvServer Object

COM Version Script Examples


VBScript examples show you how to manage scripts on systems that have multiple Mentor PCB
software installs.
Note
If you are running a 32-bit install on a 64-bit machine, ensure that you use 32-bit script hosts
in SysWoW64.

To start a 32-bit command prompt, do one of the following, depending on your operating
system:

Windows 7Choose Start > Run, type %windir%\SysWoW64\cmd.exe, then click


OK.
Windows 8Press the <Windows>-R key combination, type
%windir%\SysWoW64\cmd.exe, then click OK.

Example - Creating an instance of the last installed layout application


Dim app

' Create an instance of the Layout application (last install).


Set app = CreateObject("MGCPCB.ExpeditionPCBApplication")

Example - Creating an instance of the X-ENTP VX.1 layout application


Dim app

' Create an instance of the Layout application (for X-ENTP VX.1 install).
Set app = CreateObject("MGCPCB.ExpeditionPCBApplication.9")

Example - Using ReleaseEnvServer methods to create an instance of the layout application


' Get the environment of a specific SDD_HOME
Dim dllApp
Set dllApp = CreateObject("MGCPCBReleaseEnvironmentlib.MGCPCBReleaseEnvServer")
Call dllApp.SetEnvironment("c:\\MentorGraphics\\PADSProVX.1\\SDD_HOME")

' Launch the specific version of the Layout Application


Dim app
Set app = CreateObject("MGCPCB.ExpeditionPCBApplication" & "." &
dllApp.ProgIDVersion)

Common Automation Reference, PADS VX.2.1 11


Scripting With Multiple Installs
COM Version Script Examples

app.Visible = True

' Open a message box


MsgBox "Click OK to close xPCB Layout " & dllApp.sddVersion , vbOKOnly, "Layout
Automation"

' Exit Layout


app.Quit

Example - ReleaseEnvServer Object


Option Explicit
On Error Resume Next
Dim textFile
Dim strHome : strHome=""
dim strPlatform : strPlatform = ""

textFile = "TestOutput.txt"
' Get the application object
Dim dllApp
Set dllApp = CreateObject("MGCPCBReleaseEnvironmentLib.MGCPCBReleaseEnvServer"
)
Dim installedReleases

'Default environment -- no argument, write the parameters to a text file


dllApp.SetEnvironment("")
Call WriteTextToFile(textFile, "Default Environment:" & vbcrlf)
Call WriteTextToFile(textFile, "--------------------" & vbcrlf)
Call WriteTextToFile(textFile, "PROG_ID_VER=" & dllApp.ProgIDVersion & vbcrlf)
Call WriteTextToFile(textFile, "SDD_VERSION=" & dllApp.sddVersion & vbcrlf)
Call WriteTextToFile(textFile, "SDD_HOME=" & dllApp.sddHome & vbcrlf)
Call WriteTextToFile(textFile, "SDD_PLATFORM=" & dllApp.sddPlatform & vbcrlf)
Call WriteTextToFile(textFile, vbcrlf)

' Specific environment -- set to X-ENTP VX.1, write the parameters to a text file
Call dllApp.SetEnvironment("c:\\MentorGraphics\\EEVX.1\\SDD_HOME")
Call WriteTextToFile(textFile, "Specific Environment:" & vbcrlf)
Call WriteTextToFile(textFile, "---------------------" & vbcrlf)
Call WriteTextToFile(textFile, "PROG_ID_VER=" & dllApp.ProgIDVersion & vbcrlf)
Call WriteTextToFile(textFile, "SDD_VERSION=" & dllApp.sddVersion & vbcrlf)
Call WriteTextToFile(textFile, "SDD_HOME=" & dllApp.sddHome & vbcrlf)
Call WriteTextToFile(textFile, "SDD_PLATFORM=" & dllApp.sddPlatform & vbcrlf)
Call WriteTextToFile(textFile, vbcrlf)

If(Err) Then
MsgBox Err.Description

12 Common Automation Reference, PADS VX.2.1


Scripting With Multiple Installs
COM Version Script Examples

Err.Clear
End If

' Get all PCB releases on this machine and output them to a text file.
installedReleases = dllApp.GetInstalledReleases
Call WriteTextToFile(textFile, "List of installed releases:" & vbcrlf)
Call WriteTextToFile(textFile, "---------------------------" & vbcrlf)
WriteReleaseInformationFile(installedReleases)
Call WriteTextToFile(textFile, vbcrlf)

If(Err) Then
MsgBox Err.Description
Err.Clear
End If

Function WriteTextToFile(fileName, text)


Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim file
Set file = FSO.OpenTextFile(fileName, 8,true)
Call file.Write(text)
Call file.Close()
End Function

Sub WriteReleaseInformationFile(arrResults)
Dim str: str = ""
Dim i,j

For i = 0 To UBound(arrResults,1)
For j = 0 To UBound(arrResults,2)
'wrap token in "" and add a ,
str = str & """" & arrResults(i, j) & """" & ","
Next
str = str & vbCrLf 'add newline after each release/row
Next
Call WriteTextToFile(textFile, str)
End Sub

Related Topics
Identifying the COM Version Number of an Install
ReleaseEnvServer Object

Common Automation Reference, PADS VX.2.1 13


Scripting With Multiple Installs
ReleaseEnvServer Object

ReleaseEnvServer Object
The ReleaseEnvServer object provides access to the PCB software install environment. The
COM version of this object does not change.

Table 2-1. ReleaseEnvServer Object Methods and Properties


Method or Property Description
GetInstalledReleases Returns a two-dimensional variant array of
Method (ReleaseEnvServer releases on the current machine.
Object)
SetEnvironment Method Sets the environment. If you do not include the
(ReleaseEnvServer Object) SDD_HOME argument, the default (last installed)
environment is set.
ProgIDVersion Property Returns the COM version of the current
(ReleaseEnvServer Object) environment.
sddHome Property Returns the SDD_HOME path of the current
(ReleaseEnvServer Object) environment.
sddPlatform Property Returns the SDD_PLATFORM of the current
(ReleaseEnvServer Object) environment.
sddVersion Property Returns the SDD_VERSION of the current
(ReleaseEnvServer Object) environment.

14 Common Automation Reference, PADS VX.2.1


Scripting With Multiple Installs
GetInstalledReleases Method (ReleaseEnvServer Object)

GetInstalledReleases Method (ReleaseEnvServer


Object)
Object: ReleaseEnvServer Object
Returns a two-dimensional variant array of releases on the current machine.
Usage
ReleaseEnvServer.GetInstalledReleases()
Arguments
None.
Return Values
Variant array contains a header row of four strings. Each subsequent row lists string values for
each installed release. For example, if two releases are installed on the machine the variant array
is:
COM_VERSION SDD_HOME SDD_PLATFORM SDD_VERSION
9 C:\MentorGraphics\EEVX.1\ win32 EEVX.1
SDD_HOME
3 C:\MentorGraphics\ win32 PADSProVX.1
PADSProVX.1\SDD_HOME

Examples
Dim installedReleases
installedReleases = ReleaseEnvServer.GetInstalledReleases
WriteReleaseInformationFile(installedReleases)
...
Sub WriteReleaseInformationFile(arrResults)
' This function wraps each array element in quotes.
' Each string token is followed by a comma (,).
' Each row adds a newline.
' The str is output to a text file.
'
Dim str: str = ""
Dim i,j

For i = 0 To UBound(arrResults,1)
For j = 0 To UBound(arrResults,2)
str = str & """" & arrResults(i, j) & """" & ","
Next
str = str & vbCrLf
Next

Call WriteTextToFile(textFile, str)


End Sub

Common Automation Reference, PADS VX.2.1 15


Scripting With Multiple Installs
GetInstalledReleases Method (ReleaseEnvServer Object)

The resulting textfile:

"COM_VERSION","SDD_HOME","SDD_PLATFORM","SDD_VERSION",
"9","C:\MentorGraphics\EEVX.1\SDD_HOME","win32","EEVX.1",
3,C:\MentorGraphics\PADSProVX.1\SDD_HOME,win32,PADSProVX.1,

16 Common Automation Reference, PADS VX.2.1


Scripting With Multiple Installs
SetEnvironment Method (ReleaseEnvServer Object)

SetEnvironment Method (ReleaseEnvServer Object)


Object: ReleaseEnvServer Object
Sets the environment. If you do not include the SDD_HOME argument, the default (last
installed) environment is set.
Usage
ReleaseEnvServer.([ByVal strSDD_HOME As Nothing]) As Nothing
Arguments
strSDD_HOME
(Optional) A string that include the SDD_HOME path.
Return Values
Variant array contains a header row of four strings. Each subsequent row lists string values for
each installed release. For example, if two releases are installed on the machine the variant array
is:
COM_VERSION SDD_HOME SDD_PLATFORM SDD_VERSION
9 C:\MentorGraphics\EEVX.1\ win32 EEVX.1
SDD_HOME
3 C:\MentorGraphics\ win32 PADSProVX.1
PADSProVX.1\SDD_HOME

Examples
' Set the default environment -- no parameters
dllApp.SetEnvironment("")

' Set the X-ENTP VX.1 environment.


dllApp.SetEnvironment("c:\\MentorGraphics\\EEVX.1\\SDD_HOME")

Common Automation Reference, PADS VX.2.1 17


Scripting With Multiple Installs
ProgIDVersion Property (ReleaseEnvServer Object)

ProgIDVersion Property (ReleaseEnvServer Object)


Object: ReleaseEnvServer Object
Access: Read-only
Returns the COM version of the current environment.
Usage
ReleaseEnvServer.ProgIDVersion = String
Arguments
None.
Return Values
String that contains the COM version of the install environment.

18 Common Automation Reference, PADS VX.2.1


Scripting With Multiple Installs
sddHome Property (ReleaseEnvServer Object)

sddHome Property (ReleaseEnvServer Object)


Object: ReleaseEnvServer Object
Access: Read-only
Returns the SDD_HOME path of the current environment.
Usage
ReleaseEnvServer.sddHome = String
Arguments
None.
Return Values
String that contains the current SDD_HOME path.

Common Automation Reference, PADS VX.2.1 19


Scripting With Multiple Installs
sddPlatform Property (ReleaseEnvServer Object)

sddPlatform Property (ReleaseEnvServer Object)


Object: ReleaseEnvServer Object
Access: Read-only
Returns the SDD_PLATFORM of the current environment.
Usage
ReleaseEnvServer.sddPlatform = String
Arguments
None.
Return Values
String that contains current platform.

20 Common Automation Reference, PADS VX.2.1


Scripting With Multiple Installs
sddVersion Property (ReleaseEnvServer Object)

sddVersion Property (ReleaseEnvServer Object)


Object: ReleaseEnvServer Object
Access: Read-only
Returns the SDD_VERSION of the current environment.
Usage
ReleaseEnvServer.sddVersion = String
Arguments
None.
Return Values
String that contains SDD Version number.

Common Automation Reference, PADS VX.2.1 21


Scripting With Multiple Installs
Release Environment Server Enumerated Types

Release Environment Server Enumerated


Types
This section contains the alphabetical listing of the Release Environment Server enumerated
types. Refer to each type to determine the constants available.

Table 2-2. Release Environment Server Enumerated Types


Enumerated Type Description
EReleaseEnvErrCode Release Environment Server error codes.
Enum

22 Common Automation Reference, PADS VX.2.1


Scripting With Multiple Installs
EReleaseEnvErrCode Enum

EReleaseEnvErrCode Enum
Prerequisites: None.
Release Environment Server error codes.
Usage
EReleaseEnvErrCode.Constant
Arguments

Constant Value Description


eReleaseEnvErrCodeEnvLibraryNotFou -2147220989 The MGC PCB environment
nd (&H80040203) library for this <32/64
bit>application is not found in
the selected SDD_HOME
tree. Select a valid <32/64 bit>
installation.
eReleaseEnvErrCodeEnvWrongLibVersi -2147220988 The <32/64 bit> MGC PCB
on (&H80040204) environment library could not
be found.
eReleaseEnvErrCodeIncorrectPLATFO -2147220990 The default MGC PCB
RM (&H80040202) environment is <win32/
win64>. This application
cannot configure a <win32/
win64> environment. Select a
valid <32/64 bit> installation,
or switch to a <32/64 bit>
application.
eReleaseEnvErrCodeIncorrectSDD_HO -2147220991 Invalid SDD_HOME
ME (&H80040201) specified.
eReleaseEnvErrCodeInvalidParameter -2147220992 Invalid parameter.
(&H80040200)
eReleaseEnvErrCodeNoDefaultRelease -2147220985 There is no default MGC PCB
(&H80040207) release registered. Register a
release, or provide a valid
SDD_HOME.
eReleaseEnvErrCodeRelLibraryNotFou -2147220987 This version of the MGC PCB
nd (&H80040205) Release Reader library is not
able to get the list of registered
installs. Use a more recent
installation, or upgrade to a
newer version of the Release
Reader library.

Common Automation Reference, PADS VX.2.1 23


Scripting With Multiple Installs
EReleaseEnvErrCode Enum

Constant Value Description


eReleaseEnvErrCodeRelWrongLibVersi -2147220986 The <32/64 bit> MGC PCB
on (&H80040206) Release Reader library could
not be found.

24 Common Automation Reference, PADS VX.2.1


Chapter 3
Scripting Server

Scripting Object server is available to all applications. That is, you do not need any special calls
in your script to include this server.
Scripting Object Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Program IDs for Applications and Automation Engines . . . . . . . . . . . . . . . . . . . . . . . . . 26
Scripting Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
AddTypeLibrary Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
AttachEvents Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
CreateObject Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
ExpandEnvironmentStrings Method (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . 32
GetEnvVariable Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
SetEnvVariable Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Sleep Method (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
DontExit Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Globals Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
IsUnix Property (Scripting Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
OSName Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
OSVersion Property (Scripting Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Struct Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Count Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Data Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Item Property (Struct Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Keys Property (Struct Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Scripting Object Data Model


The following figure shows the Scripting Data model.

Common Automation Reference, PADS VX.2.1 25


Scripting Server
Program IDs for Applications and Automation Engines

Figure 3-1. Scripting Object Data Model

Program IDs for Applications and Automation


Engines
The following table provides a summary of all automation applications and their corresponding
programs IDs.

Table 3-1. Program IDs for Applications and Automation Engines


Application/Engine Program ID
Automation Licensing MGCPCBAutomationLicensing.Application
Board Station RE MGCPCB.BoardStationREApplication
Board Station XE MGCPCB.BoardStationXEApplication
Cell Editor CellEditorAddin.CellEditorDlg
DFFDRC MGCPCEngines.DFFDRC
xPCB Drawing Editor MGCPCB.DrawingEditorApplication
DrawingFileWizard MGCPCEngines.DrawingFileWizard
DRC MGCPCEngines.DRC
xDX Designer ViewDraw.Application
DXFExport MGCPCEngines.DXFExport
xPCB Layout MGCPC.ExpeditionPCBApplication
ExtendedPrint MGCPCEngines.ExtendedPrint
xPCB FabLink MGCPCB.FablinkXEApplication

26 Common Automation Reference, PADS VX.2.1


Scripting Server
Program IDs for Applications and Automation Engines

Table 3-1. Program IDs for Applications and Automation Engines (cont.)
GeneralInterfaceEngine MGCPCEngines.GeneralInterfaceEngine
Gerber MGCPCEngines.Gerber
ICX Pro Verify MGCPCB.ICXProVerifyApplication
IDFExport MGCPCEngines.IDFExport
xDM Library Tools LibraryManager.Application
ManufacturingValidationOutput MGCPCEngines.ManufacturingOutputValidation
NCDrill MGCPCEngines.NCDrill
NeutralFileExport MGCPCEngines.NeutralFileExport
ODBPPOutputEngine MGCPCEngines.ODBPPOutputEngine
Padstack Editor MGCPCBLibraries.PadstackEditorDlg
Part Editor MGCPCBLibraries.PartsEditorDlg
xPCB Planner MGCPCB.PlannerPCBApplication
xPCB Viewer MGCPCB.ViewerPCBApplication
PDFOutput MGCPCEngines.PDFOutput
SFX RE MGCPCB.SFXREApplication
SilkscreenGen MGCPCEngines.SilkscreenGen

Common Automation Reference, PADS VX.2.1 27


Scripting Server
Scripting Object

Scripting Object
The Scripting object provides a means of attaching events to dynamically created COM objects.
It also provides other useful properties and methods when running script with mgcscript
command. The Scripting object is automatically created and added to the currently running
script as a variable named Scripting.

Table 3-2. Scripting Object Methods and Properties


Method or Property Description
AddTypeLibrary Method Binds constants (enums) that the specified Type
(Scripting Object) Library defines, into the currently running script.
AttachEvents Method Attaches an object's event sources to script
(Scripting Object) functions with a given prefix.
CreateObject Method Create and return a reference to an Automation
(Scripting Object) Object. If the new object has an associated type
library, the method automatically adds the type
library to the script.
ExpandEnvironmentString Translates an environment variable string.
s Method (Scripting
Object)
GetEnvVariable Method Translate Environment variable.
(Scripting Object)
SetEnvVariable Method Set Environment variable. This will only set the
(Scripting Object) value for the current process.
Sleep Method (Scripting Suspend script execution.
Object)
DontExit Property Set to true to keep the script from exiting after the
(Scripting Object) last statement executes.
Globals Property (Scripting Returns global name/key - value pairs. Use this
Object) property for script to script communications.
IsUnix Property (Scripting Indicates whether or not the script is running on a
Object) Unix based system.
OSName Property Sets or returns the Operating System name string.
(Scripting Object)
OSVersion Property Sets or returns the Operating System version
(Scripting Object) string.

28 Common Automation Reference, PADS VX.2.1


Scripting Server
AddTypeLibrary Method (Scripting Object)

AddTypeLibrary Method (Scripting Object)


Object: Scripting Object
Binds constants (enums) that the specified Type Library defines, into the currently running
script.
Usage
Scripting.AddTypeLibrary (ByVal TypeGUIDorProgID As String,
[ByVal MajorVersion As Variant],
[ByVal MinorVersion As Variant]) As Boolean
Arguments
TypeGUIDorProgID
String specifying either a Type Library GUID in the form {8digits-4digits-4digits-4digits-
12digits} or a ProgID. For more information about the program IDs, see Program IDs for
Applications and Automation Engines.
MajorVersion
(Optional) Parameter specifying the Major version as found in the type library. The default
value is 1.
MinorVersion
(Optional) Parameter specifying the Minor version as found in the type library. The default
value is 0.
Return Values
Boolean indicating of the method succeeded (True) or failed (False).

Examples
' Use any constants defined in MGCPCB Automation layer
Call Scripting.AddTypeLibrary("MGCPCB.Application")

Common Automation Reference, PADS VX.2.1 29


Scripting Server
AttachEvents Method (Scripting Object)

AttachEvents Method (Scripting Object)


Object: Scripting Object
Attaches an object's event sources to script functions with a given prefix.
Usage
Scripting.AttachEvents (ByVal Object As Object, ByVal ObjectName As String) As Boolean
Arguments
Object
The object that you want to attach to.
ObjectName
Prefix string used to map the object events for this instance. When the object fires an event
named Foo, the script engine calls a subroutine named EventPrefix_Foo.
Return Values
Boolean indicating of the method succeeded (True) or failed (False).

Examples
' Attach application object to its event handlers with prefix appEvents
Dim app
Set app = GetObject(, "MGCPCB.Application")
Call Scripting.AttachEvents(app, "appEvents")

30 Common Automation Reference, PADS VX.2.1


Scripting Server
CreateObject Method (Scripting Object)

CreateObject Method (Scripting Object)


Object: Scripting Object
Create and return a reference to an Automation Object. If the new object has an associated type
library, the method automatically adds the type library to the script.
Usage
Scripting.CreateObject (ByVal Class As String, [ByVal EventPrefix As Variant]) As Object
Arguments
Class
ProgID in the form Servername.Typename that specifies the object to create. For more
information about the program IDs, see Program IDs for Applications and Automation
Engines.
EventPrefix
(Optional) Optional argument used to bind to the outgoing interface of the object. If
specified, the script engine connects the object's outgoing interface to the script file after
creating the object. When the object fires an event, the script engine calls a subroutine
named EventPrefix and the event name. For example, if EventPrefix is MyObj and the
object fires an event named OnBegin, The scripting engine calls the MyObj_OnBegin
subroutine located in the script. The underscore is automatically added between then
EventPrefix and the Event name.
Return Values
String naming the newly created object.

Examples
' Create an xPCB Layout application object
Dim appPCB
Set appPCB = Scripting.CreateObject("MGCPCB.ExpeditionPCBApplication.9")

Related Topics
Scripting With Multiple Installs

Common Automation Reference, PADS VX.2.1 31


Scripting Server
ExpandEnvironmentStrings Method (Scripting Object)

ExpandEnvironmentStrings Method (Scripting


Object)
Object: Scripting Object
Translates an environment variable string.
Usage
Scripting.ExpandEnvironmentStrings (ByVal InputStr As String) As String
Arguments
InputStr
String containing %VAR%s to translate.
Return Values
Translated string or an empty string if not found.

32 Common Automation Reference, PADS VX.2.1


Scripting Server
GetEnvVariable Method (Scripting Object)

GetEnvVariable Method (Scripting Object)


Object: Scripting Object
Translate Environment variable.
Usage
Scripting.GetEnvVariable (ByVal VariableName As String) As String
Arguments
VariableName
The name of the Environment variable to translate.
Return Values
Translated String or an empty string if not found.

Common Automation Reference, PADS VX.2.1 33


Scripting Server
SetEnvVariable Method (Scripting Object)

SetEnvVariable Method (Scripting Object)


Object: Scripting Object
Set Environment variable. This will only set the value for the current process.
Usage
Scripting.SetEnvVariable (ByVal VariableName As String, ByVal Value As String) As
Boolean
Arguments
VariableName
Name of the environment variable.
Value
Value of the environment variable.
Return Values
Boolean indicating of the method succeeded (True) or failed (False).

34 Common Automation Reference, PADS VX.2.1


Scripting Server
Sleep Method (Scripting Object)

Sleep Method (Scripting Object)


Object: Scripting Object
Suspend script execution.
Usage
Scripting.Sleep (ByVal nMilliseconds As Long)
Arguments
nMilliseconds
Time in milliseconds to suspend script execution.

Common Automation Reference, PADS VX.2.1 35


Scripting Server
DontExit Property (Scripting Object)

DontExit Property (Scripting Object)


Object: Scripting Object
Access: Read\Write
Set to true to keep the script from exiting after the last statement executes.
Usage
Scripting.DontExit = True | False
Arguments
None.
Return Values
Boolean, if True, keep the script from exiting after the last statement executes. If False, exit the
script after the last statement executes.

36 Common Automation Reference, PADS VX.2.1


Scripting Server
Globals Property (Scripting Object)

Globals Property (Scripting Object)


Object: Scripting Object
Access: Read-Only
Returns global name/key - value pairs. Use this property for script to script communications.
Usage
Scripting.Globals
Arguments
None.
Return Values
Object, the Scripting Object.

Examples
To store a global name/key - value pair:

Scripting.Globals("MyGlobalName") = "MyGlobalValue"

To read from a global name/key -value pair:

MsgBox Scripting.Globals("MyGlobalName")
Returns MyGlobalValue

To store a global object:

Scripting.Globals.Data(MyGlobalObjName) = myObj

To output the global objects name:

MsgBox Scripting.Globals("MyGlobalObjName").Name
Returns the value of myObj.Name

To iterate the keys:

For Each key In Scripting.Globals.Keys


MsgBox key & "=" & Scripting.Globals(key)
Next

Common Automation Reference, PADS VX.2.1 37


Scripting Server
IsUnix Property (Scripting Object)

IsUnix Property (Scripting Object)


Object: Scripting Object
Access: Read-only
Indicates whether or not the script is running on a Unix based system.
Usage
Scripting.IsUnix = True | False
Arguments
None.
Return Values
Boolean. If True, the system is UNIX-based. If False, the system is not UNIX-based.

38 Common Automation Reference, PADS VX.2.1


Scripting Server
OSName Property (Scripting Object)

OSName Property (Scripting Object)


Object: Scripting Object
Access: Read\Write
Sets or returns the Operating System name string.
Usage
Scripting.OSName = String
Arguments
None.
Return Values
A string that contains the name of the operating system.

Common Automation Reference, PADS VX.2.1 39


Scripting Server
OSVersion Property (Scripting Object)

OSVersion Property (Scripting Object)


Object: Scripting Object
Access: Read\Write
Sets or returns the Operating System version string.
Usage
Scripting.OSVersion = String
Arguments
None.
Return Values
A string that contains the version of the operating system.

40 Common Automation Reference, PADS VX.2.1


Scripting Server
Struct Object

Struct Object
The Struct object holds Key - Value pairs. This object returns from the Globals Property
(Scripting Object) and the Utility.Globals property.
The Struct object is a static object in the context of a process space. Therefore, any in-process
script or form that accesses the Struct object is accessing the same object. This means that one
script can write data to the object and a different script can read the same data.

The Globals Property (Scripting Object) works only in the current process space.

The Utility.Globals property also allows out-of-process scripts, forms, addins, or any other
client to access the Struct object without being in the same process space.
Table 3-3. Struct Object Properties
Property Description
Count Property (Struct Returns the number of items in the struct object.
Object)
Data Property (Struct Sets or returns an object.
Object)
Item Property (Struct Sets or returns a value based on a name/key.
Object)
Keys Property (Struct Returns the collection of names/keys.
Object)

Common Automation Reference, PADS VX.2.1 41


Scripting Server
Count Property (Struct Object)

Count Property (Struct Object)


Object: Struct Object
Access: Read-Only
Returns the number of items in the struct object.
Usage
Struct.Count
Arguments
None.
Return Values
Long. The number of items.

42 Common Automation Reference, PADS VX.2.1


Scripting Server
Data Property (Struct Object)

Data Property (Struct Object)


Object: Struct Object
Access: Read\Write
Sets or returns an object.
Usage
Stuct.Data (ByVal Name As String) = Object
Arguments
Name
A string that contains the key/name.
Return Values
Object. The object associated with key/name.

Examples
To store a global object:

Set Scripting.Globals(MyGlobalObjName).Data = myObj

To output the global objects name:

MsgBox Scripting.Globals("MyGlobalObjName").Name
Returns the value of myObj.Name

Common Automation Reference, PADS VX.2.1 43


Scripting Server
Item Property (Struct Object)

Item Property (Struct Object)


Object: Struct Object
Access: Read\Write
Sets or returns a value based on a name/key.
Usage
Stuct.Item(ByVal Index As Variant) = Value
Arguments
Index
A name or key.
Return Values
The value of the name/key. The value can be any type.

44 Common Automation Reference, PADS VX.2.1


Scripting Server
Keys Property (Struct Object)

Keys Property (Struct Object)


Object: Struct Object
Access: Read-Only
Returns the collection of names/keys.
Usage
Struct.Keys
Arguments
None.
Return Values
The collection of keys.

Examples
To iterate the keys:

For Each key In Scripting.Globals.Keys


MsgBox key & "=" & Scripting.Globals(key)
Next

Common Automation Reference, PADS VX.2.1 45


Scripting Server
Keys Property (Struct Object)

46 Common Automation Reference, PADS VX.2.1


Chapter 4
CommandBar Server

The CommandBar Server lets you to customize the toolbars and menus of applications.
CommandBarServer Data Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
CommandBar Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Controls Property (CommandBar Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
CommandBarButton Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Delete Method (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
BitmapFile Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
BitmapResource Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . 55
Caption Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
DescriptionText Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Enabled Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
ExecuteMethod Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Id Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
OnAction Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ResourceDLL Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Target Property (CommandBarButton Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
TooltipText Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
UpdateMethod Property (CommandBarButton Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
CommandBarControl Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Delete Method (CommandBarControl Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Caption Property (CommandBarControl Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
CommandBarPopup Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Delete Method (CommandBarPopup Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Caption Property (CommandBarPopup Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Controls Property (CommandBarPopup Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
CommandBarControls Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Add Method (CommandBarControls Collection). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Count Property (CommandBarControls Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Item Property (CommandBarControls Collection). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
CommandBars Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Item Property (CommandBars Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Command Bar Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
CmdControlType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Common Automation Reference, PADS VX.2.1 47


CommandBar Server
CommandBarServer Data Model

CommandBarServer Data Model


The following figure shows the CommandBarServer Data model.
Figure 4-1. CommandBarServer Data Model

48 Common Automation Reference, PADS VX.2.1


CommandBar Server
CommandBar Object

CommandBar Object
Lists the CommandBarControl properties.

Table 4-1. CommandBar Object Properties


Property Description
Controls Property Returns the collection of command bar controls of
(CommandBar Object) the command bar object.

Common Automation Reference, PADS VX.2.1 49


CommandBar Server
Controls Property (CommandBar Object)

Controls Property (CommandBar Object)


Object: CommandBar Object
Access: Read-Only
Returns the collection of command bar controls of the command bar object.
Usage
CommandBar.Controls
Arguments
None.
Return Values
The collection of command bar controls (CommandBarControls) of the command bar.

50 Common Automation Reference, PADS VX.2.1


CommandBar Server
CommandBarButton Object

CommandBarButton Object
Lists the CommandBarButton methods and properties.

Table 4-2. CommandBarButton Object Methods and Properties


Method or Property Description
Delete Method Delete the command bar button in the
(CommandBarButton corresponding command bar.
Object)
BitmapFile Property Sets or returns the bitmap file used by the
(CommandBarButton commandbar button. The bitmap should be 16 x
Object) 16.
BitmapResource Property Sets or returns the id of the bitmap resource to
(CommandBarButton load. It is loaded from the ResourceDLL.
Object)
Caption Property Sets or returns the caption text of the commandbar
(CommandBarButton button. The caption text is used as the
Object) commandbar button's ScreenTip.
DescriptionText Property Sets or returns the description text of the
(CommandBarButton commandbar button. The text is displayed in the
Object) status bar.
Enabled Property Enable or disable the commandbar button. Only
(CommandBarButton user-defined command can be enabled / disabled
Object) by this property.
ExecuteMethod Property Sets or returns the procedure associated with the
(CommandBarButton commandbar button.
Object)
Id Property Returns the ID of the command associated with
(CommandBarButton the commandbar button.
Object)
OnAction Property Sets or returns the action to be taken when the
(CommandBarButton commandbar button is clicked.
Object)
ResourceDLL Property Sets or returns the .dll from which the bitmap
(CommandBarButton resource for the button is loaded.
Object)
Target Property Sets or returns the target COM object associated
(CommandBarButton with the commandbar button.
Object)

Common Automation Reference, PADS VX.2.1 51


CommandBar Server
CommandBarButton Object

Table 4-2. CommandBarButton Object Methods and Properties (cont.)


Method or Property Description
TooltipText Property Sets or returns the tooltip text of the commandbar
(CommandBarButton button.
Object)
UpdateMethod Property Sets or returns the method when to enable or
(CommandBarButton disable the commandbar button.
Object)

52 Common Automation Reference, PADS VX.2.1


CommandBar Server
Delete Method (CommandBarButton Object)

Delete Method (CommandBarButton Object)


Object: CommandBarButton Object
Delete the command bar button in the corresponding command bar.
Usage
CommandBarButton.Delete ()
Arguments
None.

Common Automation Reference, PADS VX.2.1 53


CommandBar Server
BitmapFile Property (CommandBarButton Object)

BitmapFile Property (CommandBarButton Object)


Object: CommandBarButton Object
Access: Read\Write
Sets or returns the bitmap file used by the commandbar button. The bitmap should be 16 x 16.
Usage
CommandBarButton.BitmapFile = String
Arguments
None.
Return Values
A string that represents the full path of the bitmap file used by the commandbar button.

54 Common Automation Reference, PADS VX.2.1


CommandBar Server
BitmapResource Property (CommandBarButton Object)

BitmapResource Property (CommandBarButton


Object)
Object: CommandBarButton Object
Access: Read\Write
Sets or returns the id of the bitmap resource to load. It is loaded from the ResourceDLL.
Usage
CommandBarButton.BitmapResource = Long
Arguments
None.
Return Values
A long that contains the bitmap resource.

Description
If the ResourceDLL is not set, the bitmap is not loaded. For more information on resources and
C++ clients for Automation see the MSDN site.

Common Automation Reference, PADS VX.2.1 55


CommandBar Server
Caption Property (CommandBarButton Object)

Caption Property (CommandBarButton Object)


Object: CommandBarButton Object
Access: Read\Write
Sets or returns the caption text of the commandbar button. The caption text is used as the
commandbar button's ScreenTip.
Usage
CommandBarButton.Caption = String
Arguments
None.
Return Values
A string that represents the caption text of the commandbar button.

56 Common Automation Reference, PADS VX.2.1


CommandBar Server
DescriptionText Property (CommandBarButton Object)

DescriptionText Property (CommandBarButton


Object)
Object: CommandBarButton Object
Access: Read\Write
Sets or returns the description text of the commandbar button. The text is displayed in the status
bar.
Usage
CommandBarButton.DescriptionText = String
Arguments
None.
Return Values
A string that represents the description text of the command bar button.

Common Automation Reference, PADS VX.2.1 57


CommandBar Server
Enabled Property (CommandBarButton Object)

Enabled Property (CommandBarButton Object)


Object: CommandBarButton Object
Access: Read\Write
Enable or disable the commandbar button. Only user-defined command can be enabled /
disabled by this property.
Usage
CommandBarButton.Enabled = True | False
Arguments
None.
Return Values
Boolean. If True, the command bar button is enabled. If False, the command bar button is
disabled.

58 Common Automation Reference, PADS VX.2.1


CommandBar Server
ExecuteMethod Property (CommandBarButton Object)

ExecuteMethod Property (CommandBarButton


Object)
Object: CommandBarButton Object
Access: Read\Write
Sets or returns the procedure associated with the commandbar button.
Usage
CommandBarButton.ExecuteMethod = String
Arguments
None.
Return Values
A string that represents the procedure to be run when the button is clicked.

Examples
'
' This example add a menu entry to execute a method defined in the script
'
' With the menu controls collection
Set button = myMenuCtrls.Add
button.Caption = "Zoom Selected"
button.Target = ScriptEngine
button.ExecuteMethod = "myZoomSelectedMethod"
' call function below with this name
button.DescriptionText = "Zoom around selected objects"

Sub myZoomSelectedMethod( )
' zoom around selected objects
doc.ActiveViewEx.SetExtentsToSelection
End Sub

Common Automation Reference, PADS VX.2.1 59


CommandBar Server
Id Property (CommandBarButton Object)

Id Property (CommandBarButton Object)


Object: CommandBarButton Object
Access: Read-Only
Returns the ID of the command associated with the commandbar button.
Usage
CommandBarButton.Id
Arguments
None.
Return Values
A long that represents the ID of command associated with the commandbar button.

60 Common Automation Reference, PADS VX.2.1


CommandBar Server
Id Property (CommandBarButton Object)

Examples
'
' This example walks through the menus of a PCB application and
' write the menu name and its command ID out to a output file.
'
' Create an output file
Set filesys = CreateObject("Scripting.FileSystemObject")
file = "c:\temp\output.txt"
Set filetxt = filesys.CreateTextFile(file, True)

' Get the document menu bar object


Dim docMenuBar
Set docMenuBar = Gui.CommandBars("Document Menu Bar")

' Walk through all menu in the menu bar


' and write out its name and command id
' to a file
xTab = vbTab
For i = 1 To docMenuBar.Controls.Count
Set menu = docMenuBar.Controls.Item(i)
filetxt.WriteLine "+" & menu.Caption
Call WriteMenuIDs(menu)
filetxt.WriteLine
Next
' Subroutine to write out menu item name
' and its command ID
Sub WriteMenuIDs(menu)
Set menuCtrls = menu.Controls
For j = 1 To menuCtrls.Count
cmdName = menuCtrls.Item(j).Caption
On Error Resume Next
id = menuCtrls.Item(j).Id
If Err Then
' CommandBarPopup doesn't support Id property
Err.Clear
filetxt.WriteLine xTab & cmdName
saveTab = xTab
xTab = xTab & vbTab
Call WriteMenuIDs(menuCtrls.Item(j))
xTab = saveTab
ElseIf id <> 0 Then
' Don't write out separator whose command id is 0
filetxt.WriteLine xTab & cmdName & " : " & id
End If
Next
End Sub
MsgBox "fini"

Common Automation Reference, PADS VX.2.1 61


CommandBar Server
OnAction Property (CommandBarButton Object)

OnAction Property (CommandBarButton Object)


Object: CommandBarButton Object
Access: Read\Write
Sets or returns the action to be taken when the commandbar button is clicked.
Usage
CommandBarButton.OnAction = String
Arguments
None.
Return Values
A string that represents the action to be taken when the commandbar button is clicked.

Description
This property is used for creating a new menu entry or toolbar button associated with a PCB
application built-in command, or key-in command.

Examples
'
' This example adds a menu entry using built-in command, Highlight
'
' With the menu object (CommandBar) defined
Set cntrls = menu.Controls
Set button = cntrls.Add
button.Caption = "&Highlight"
button.OnAction = "32867" ' 32867 is the ID of the built-in command,
Highlight

62 Common Automation Reference, PADS VX.2.1


CommandBar Server
ResourceDLL Property (CommandBarButton Object)

ResourceDLL Property (CommandBarButton


Object)
Object: CommandBarButton Object
Access: Read\Write
Sets or returns the .dll from which the bitmap resource for the button is loaded.
Usage
CommandBarButton.ResourceDLL = String
Arguments
None.
Return Values
A string that contains the name of the .dll.

Description
This property is used in conjunction with the BitmapResource property.

Common Automation Reference, PADS VX.2.1 63


CommandBar Server
Target Property (CommandBarButton Object)

Target Property (CommandBarButton Object)


Object: CommandBarButton Object
Access: Read\Write
Sets or returns the target COM object associated with the commandbar button.
Usage
CommandBarButton.Target = COM Object
Arguments
COM Object.
The name of the COM object associated with the commandbar button.
Return Values
Examples
'
' This example add a menu entry to execute a method defined in the script
'
' With the menu controls collection
Set button = myMenuCtrls.Add
button.Caption = "Zoom Selected"
'The target COM object is this scripting engine
button.Target = ScriptEngine
button.ExecuteMethod = "myZoomSelectedMethod"
button.DescriptionText = "Zoom around selected objects"

Sub myZoomSelectedMethod( )
' zoom around selected objects
doc.ActiveViewEx.SetExtentsToSelection
End Sub

64 Common Automation Reference, PADS VX.2.1


CommandBar Server
TooltipText Property (CommandBarButton Object)

TooltipText Property (CommandBarButton Object)


Object: CommandBarButton Object
Access: Read\Write
Sets or returns the tooltip text of the commandbar button.
Usage
CommandBarButton.TooltipText = String
Arguments
None.
Return Values
A string that represents the tooltip text of the command bar button.

Common Automation Reference, PADS VX.2.1 65


CommandBar Server
UpdateMethod Property (CommandBarButton Object)

UpdateMethod Property (CommandBarButton


Object)
Object: CommandBarButton Object
Access: Read\Write
Sets or returns the method when to enable or disable the commandbar button.
Usage
CommandBarButton.UpdateMethod = String
Arguments
None.
Return Values
A string that represents the method when to enable or disable the commandbar button.

Examples
'
' This example add a menu entry to execute a key-in command, "pr *" with a
' user-defined update method to enable/disable the menu entry
'
' With the menu controls collection object (CommandBarControls) defined
Set button = myMenuCtrls.Add
button.Caption = "Place Unplaced Parts"
button.OnAction = "pr *"
button.Target = ScriptEngine
button.UpdateMethod = "onUpdatePlaceUnplaced"
' call update method below with this name

Function onUpdatePlaceUnplaced(nID)
' Disable the command if no unplaced parts
If doc.components(epcbSelectUnplaced).count > 0 Then
onUpdatePlaceUnplaced = true
Else
onUpdatePlaceUnplaced = false
End If
End Function

66 Common Automation Reference, PADS VX.2.1


CommandBar Server
CommandBarControl Object

CommandBarControl Object
Lists the CommandBarControl methods and properties.

Table 4-3. CommandBarControl Object Methods and Properties


Method or Property Description
Delete Method Deletes the command bar control in the
(CommandBarControl corresponding command bar.
Object)
Caption Property Sets or returns the caption text of the command
(CommandBarControl bar control.
Object)

Common Automation Reference, PADS VX.2.1 67


CommandBar Server
Delete Method (CommandBarControl Object)

Delete Method (CommandBarControl Object)


Object: CommandBarControl Object
Deletes the command bar control in the corresponding command bar.
Usage
CommandBarControl.Delete ()
Arguments
None.

68 Common Automation Reference, PADS VX.2.1


CommandBar Server
Caption Property (CommandBarControl Object)

Caption Property (CommandBarControl Object)


Object: CommandBarControl Object
Access: Read\Write
Sets or returns the caption text of the command bar control.
Usage
CommandBarControl.Caption = String
Arguments
None.
Return Values
A string that represents the caption text of the command bar control.

Common Automation Reference, PADS VX.2.1 69


CommandBar Server
CommandBarPopup Object

CommandBarPopup Object
Lists the CommandBarPopup methods and properties.

Table 4-4. CommandBarPopup Object Methods and Properties


Method or Property Description
Delete Method Delete the command bar popup in the
(CommandBarPopup corresponding command bar.
Object)
Caption Property Sets or returns the caption text of the commandbar
(CommandBarPopup popup.
Object)
Controls Property Returns the commandbar controls collection of
(CommandBarPopup the commandbar popup.
Object)

70 Common Automation Reference, PADS VX.2.1


CommandBar Server
Delete Method (CommandBarPopup Object)

Delete Method (CommandBarPopup Object)


Object: CommandBarPopup Object
Delete the command bar popup in the corresponding command bar.
Usage
CommandBarPopup.Delete ()
Arguments
None.

Common Automation Reference, PADS VX.2.1 71


CommandBar Server
Caption Property (CommandBarPopup Object)

Caption Property (CommandBarPopup Object)


Object: CommandBarPopup Object
Access: Read\Write
Sets or returns the caption text of the commandbar popup.
Usage
CommandBarPopup.Caption = String
Arguments
None.
Return Values
A string that represents the caption text of the commandbar popup.

72 Common Automation Reference, PADS VX.2.1


CommandBar Server
Controls Property (CommandBarPopup Object)

Controls Property (CommandBarPopup Object)


Object: CommandBarPopup Object
Access: Read-Only
Returns the commandbar controls collection of the commandbar popup.
Usage
CommandBarPopup.Controls
Arguments
None.
Return Values
CommandBarControls. The collection of commandbar controls (CommandBarControls) of the
commandbar popup.

Common Automation Reference, PADS VX.2.1 73


CommandBar Server
CommandBarControls Collection

CommandBarControls Collection
Lists the CommandBarControls methods and properties.

Table 4-5. CommandBarControls Collection Methods and Properties


Method or Property Description
Add Method Adds a commandbar control object to the
(CommandBarControls collection.
Collection)
Count Property Returns the number of commandbar control
(CommandBarControls objects contained in the commandbar controls
Collection) collection.
Item Property Returns a commandbar control object contained
(CommandBarControls in the commandbar controls collection.
Collection)

74 Common Automation Reference, PADS VX.2.1


CommandBar Server
Add Method (CommandBarControls Collection)

Add Method (CommandBarControls Collection)


Object: CommandBarControls Collection
Adds a commandbar control object to the collection.
Usage
CommandBarControls.Add (ByVal Type As Variant,
ByVal Id As Variant,
ByVal Parameter As Variant,
ByVal Before As Variant) As CommandBarControl
Arguments
Type
The control type (CmdControlType) of the commandbar control.
Id
(Optional) The ID of the command associated with the commandbar control. Omitted the
parameter will have the commandbar server assign an ID for the control.
Parameter
(Optional) Reserved for future use.
Before
The position before which the new control is added.
Return Values
CommandBarControl. The object (CommandBarControl) to add to the collection.

Common Automation Reference, PADS VX.2.1 75


CommandBar Server
Count Property (CommandBarControls Collection)

Count Property (CommandBarControls Collection)


Object: CommandBarControls Collection
Access: Read\Write
Returns the number of commandbar control objects contained in the commandbar controls
collection.
Usage
CommandBarControls.Count = Long
Arguments
None.
Return Values
Long. The number of commandbar control objects the collection contains.

76 Common Automation Reference, PADS VX.2.1


CommandBar Server
Item Property (CommandBarControls Collection)

Item Property (CommandBarControls Collection)


Object: CommandBarControls Collection
Access: Read-Only
Returns a commandbar control object contained in the commandbar controls collection.
Usage
CommandBarControls.Item (ByVal Index As Variant)
Arguments
Index
Index of the object to retrieve from the collection
Return Values
CommandBarControl. The object (CommandBarControl) located at position Index.

Common Automation Reference, PADS VX.2.1 77


CommandBar Server
CommandBars Collection

CommandBars Collection
Lists the CommandBars properties.

Table 4-6. CommandBars Collection Properties


Property Description
Item Property Returns a commandbar object contained in the
(CommandBars commandbars collection.
Collection)

78 Common Automation Reference, PADS VX.2.1


CommandBar Server
Item Property (CommandBars Collection)

Item Property (CommandBars Collection)


Object: CommandBars Collection
Access: Read-Only
Returns a commandbar object contained in the commandbars collection.
Usage
CommandBars.Item (ByVal Index As Variant)
Arguments
Index
Index of the CommandBar object to retrieve from the collection.
Return Values
The object (CommandBar) located at position Index.

Common Automation Reference, PADS VX.2.1 79


CommandBar Server
Command Bar Enumerated Types

Command Bar Enumerated Types


Lists the CommandBar enumerated types.

Table 4-7. CommandBar Enumerated Types


Enumerated Type Description
CmdControlType Enum Constants for CommandBarControls Add method.

80 Common Automation Reference, PADS VX.2.1


CommandBar Server
CmdControlType Enum

CmdControlType Enum
Constants for CommandBarControls Add method.
Usage
CmdControlType.Constant
Arguments
Constant
You can specify three types of constants:
cmdControlButton
The value for this constant is 0. Button control.
cmdControlButtonSeparator
The value for this constant is 2. Button Separator.
cmdControlPopup
The value for this constant is 1. Popup menu control.

Common Automation Reference, PADS VX.2.1 81


CommandBar Server
CmdControlType Enum

82 Common Automation Reference, PADS VX.2.1


Chapter 5
KeyBind Server

The KeyBind Server lets you to define custom shortcuts or key accelerators for applications.
KeyBindServer Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
KeyBinding Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Command Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
ExecuteMethod Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Id Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Key Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
KeyType Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Target Property (KeyBinding Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Type Property (KeyBinding Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
VirtualKey Property (KeyBinding Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
BindingTables Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
AddKeyBinding Method (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
AddStrokeBinding Method (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Bindings Property (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Item Property (BindingTables Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
KeyBindings Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Remove Method (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Count Property (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Item Property (KeyBindings Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Key Binding Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
BindKeyType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
BindType Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

KeyBindServer Data Model


The following figure shows the KeyBindServer Data model.

Common Automation Reference, PADS VX.2.1 83


KeyBind Server
KeyBindServer Data Model

Figure 5-1. KeyBindServer Data Model

84 Common Automation Reference, PADS VX.2.1


KeyBind Server
KeyBinding Object

KeyBinding Object
Lists the KeyBinding properties.

Table 5-1. KeyBinding Object Properties


Property Description
Command Property Returns the menu command or key-in command
(KeyBinding Object) associated with the keybinding object.
ExecuteMethod Property Sets or returns the procedure associated with the
(KeyBinding Object) keybinding object.
Id Property (KeyBinding Returns the ID of command associated with the
Object) keybinding object. (key-in command returns -1)
Key Property (KeyBinding Returns the key combination associated with the
Object) keybinding object.
KeyType Property Returns the key type of the keybinding object.
(KeyBinding Object)
Target Property Sets or returns the target COM object associated
(KeyBinding Object) with the key binding object.
Type Property Returns the type of the keybinding object.
(KeyBinding Object)
VirtualKey Property Returns the ANSI number of the key associated
(KeyBinding Object) with the keybinding object.

Common Automation Reference, PADS VX.2.1 85


KeyBind Server
Command Property (KeyBinding Object)

Command Property (KeyBinding Object)


Object: KeyBinding Object
Access: Read-Only
Returns the menu command or key-in command associated with the keybinding object.
Usage
KeyBinding.Command
Arguments
None.
Return Values
A string that represents the menu command or key-in command.

Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation",0,1

' With KeyBindings object defined


' Command property will return "Help->Contents->Automation"
MsgBox docKeyBindings.Item(1).Command

86 Common Automation Reference, PADS VX.2.1


KeyBind Server
ExecuteMethod Property (KeyBinding Object)

ExecuteMethod Property (KeyBinding Object)


Object: KeyBinding Object
Access: Read\Write
Sets or returns the procedure associated with the keybinding object.
Usage
KeyBinding.ExecuteMethod = String
Arguments
None.
Return Values
A string that represents the procedure to be run when the assigned accelerator key (or key
combination) is pressed.

Examples
'
' This example adds a key binding to execute a method defined in the
' script
'
' Assign shortcut keys Alt+F1 to myZoomSelectedMethod
Set bindObj = docBindingTables.AddKeyBinding ("Alt+F1", _
"myZoomSelectedMethod", BindFunction, BindAccelerator)

' Associate the current script engine with the key binding
bindObj.Target = ScriptEngine
' Call method below with this name
bindObj.ExecuteMethod = "myZoomSelectedMethod"
' Keep this script running so that the handler can be executed
Scripting.DontExit = True

Sub myZoomSelectedMethod( )
' Zoom around selected objects
doc.ActiveViewEx.SetExtentsToSelection
End Sub

Common Automation Reference, PADS VX.2.1 87


KeyBind Server
Id Property (KeyBinding Object)

Id Property (KeyBinding Object)


Object: KeyBinding Object
Access: Read-Only
Returns the ID of command associated with the keybinding object. (key-in command returns -1)
Usage
KeyBinding.Id
Arguments
None.
Return Values
A long that represents the ID of the command associated with the keybinding object.

Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation",0,1

' With KeyBindings object defined


' Id property will return 33818, which is the internal command id.
MsgBox docKeyBindings.Item(1).Id

88 Common Automation Reference, PADS VX.2.1


KeyBind Server
Key Property (KeyBinding Object)

Key Property (KeyBinding Object)


Object: KeyBinding Object
Access: Read-Only
Returns the key combination associated with the keybinding object.
Usage
KeyBinding.Key
Arguments
None.
Return Values
A string that represents the shortcut keys combination associated with the keybinding object.

Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation",0,1

' With KeyBindings object defined


' Key property will return Alt+F1
MsgBox docKeyBindings.Item(1).Key

Common Automation Reference, PADS VX.2.1 89


KeyBind Server
KeyType Property (KeyBinding Object)

KeyType Property (KeyBinding Object)


Object: KeyBinding Object
Access: Read-Only
Returns the key type of the keybinding object.
Usage
KeyBinding.KeyType
Arguments
None.
Return Values
A long that represents the key type (BindKeyType) of the keybinding object.

Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation",0,1

' With KeyBindings object defined


' KeyType property will return 1 which is BindAccelerator constant
MsgBox docKeyBindings.Item(1).KeyType

90 Common Automation Reference, PADS VX.2.1


KeyBind Server
Target Property (KeyBinding Object)

Target Property (KeyBinding Object)


Object: KeyBinding Object
Access: Read\Write
Sets or returns the target COM object associated with the key binding object.
Usage
KeyBinding.Target = COM Object
Arguments
COM Object
The name of the COM object associated with the key binding.
Examples
'
' This example adds a key binding to execute a method defined in the
' script
'
' Assign shortcut keys Alt+F1 to myZoomSelectedMethod
Set bindObj = docBindingTables.AddKeyBinding ("Alt+F1", _
"myZoomSelectedMethod", BindFunction, BindAccelerator)

' Associate the current script engine with the key binding
bindObj.Target = ScriptEngine
' Call method below with this name
bindObj.ExecuteMethod = "myZoomSelectedMethod"
' Keep this script running so that the handler can be executed
Scripting.DontExit = True

Sub myZoomSelectedMethod( )
' Zoom around selected objects
doc.ActiveViewEx.SetExtentsToSelection
End Sub

Common Automation Reference, PADS VX.2.1 91


KeyBind Server
Type Property (KeyBinding Object)

Type Property (KeyBinding Object)


Object: KeyBinding Object
Access: Read-Only
Returns the type of the keybinding object.
Usage
KeyBinding.Type
Arguments
None.
Return Values
A long that represents the type (BindType) of the keybinding object.

Examples
' With BindingTables object defined
' Assign shortcut keys Alt+F1 to Help->Contents->Automation
docBindingTables.AddKeyBinding "Alt+F1","Help->Contents->Automation", 0,1
' With KeyBindings object defined
' Type property will return 0 which is BindMenu constant
MsgBox docKeyBindings.Item(1).Type

92 Common Automation Reference, PADS VX.2.1


KeyBind Server
VirtualKey Property (KeyBinding Object)

VirtualKey Property (KeyBinding Object)


Object: KeyBinding Object
Access: Read-Only
Returns the ANSI number of the key associated with the keybinding object.
Usage
KeyBinding.VirtualKey
Arguments
None.
Return Values
A long that represents the ANSI number of the key associated with the keybinding object.

Examples
' With BindingTables object defined
' Assign shortcut keys Alt+2 to View->FitAll command
docBindingTables.AddKeyBinding "Alt+2", "View->FitAll", 0, 1

' With KeyBindings object defined


' VirtualKey property will return 50 which is the ANSI number of key "2"
MsgBox docKeyBindings.Item(1).VirtualKey

Common Automation Reference, PADS VX.2.1 93


KeyBind Server
BindingTables Collection

BindingTables Collection
Lists the BindingTables methods and properties.

Table 5-2. BindingTables Collection Methods and Properties


Method or Property Description
AddKeyBinding Method Adds a shortcut key assignment to the
(BindingTables Collection) keybindings collection.
AddStrokeBinding Method Adds a Stroke to the KeyBindings collection.
(BindingTables Collection)
Bindings Property Returns the collection of keybinding objects of
(BindingTables Collection) the BindingTables.
Item Property Returns a keybinding object contained in the
(BindingTables Collection) keybindings collection.

94 Common Automation Reference, PADS VX.2.1


KeyBind Server
AddKeyBinding Method (BindingTables Collection)

AddKeyBinding Method (BindingTables Collection)


Object: BindingTables Collection
Adds a shortcut key assignment to the keybindings collection.
Usage
BindingTables.AddKeyBinding (ByVal KeySequence As String,
ByVal Command As String,
ByVal BindType As Variant,
ByVal KeyType As Variant,
ByVal UserData As Variant) As IKeyBinding
Arguments
KeySequence
A string that represents the shortcut keys combination.
Command
A string that represents the menu command or key-in command assigned to the shortcut
keys.
BindType
A BindType constant that defines what command type the shortcut key is assigned to.
KeyType
BindKeyType constant that defines the binding type of the shortcut keys.
UserData
(Optional) Reserved for future use.
Return Values
IKeyBinding. The new KeyBinding Object.

Examples
' Get the document BindingTables object
Set docBindingTables = Gui.Bindings("Document")

' Assign shortcut keys Alt+F1 to Help->Contents->Automation


docBindingTables.AddKeyBinding "Alt+F1", "Help->Contents->Automation",
BindMenu, BindAccelerator

Common Automation Reference, PADS VX.2.1 95


KeyBind Server
AddStrokeBinding Method (BindingTables Collection)

AddStrokeBinding Method (BindingTables


Collection)
Object: BindingTables Collection
Adds a Stroke to the KeyBindings collection.
Usage
BindingTables.AddStrokeBinding (ByVal Stroke As String,
ByVal Command As String
ByVal BindType As Variant,
ByVal UserData As Variant) As IKeyBinding
Description
You can overwrite existing Stokes in the application. Refer to the Strokes topic in the
application help for more information on Strokes.

Arguments
String
A string that Stroke pattern.
Command
A string that contains the menu command, script function, keyin command or key to assign
to the Stroke.
BindType
A BindType constant that defines the command typekey press, menu command, script
function, or keyin command.
UserData
(Optional) Reserved for future use.
Return Values
IKeyBinding. The new KeyBinding Object.

96 Common Automation Reference, PADS VX.2.1


KeyBind Server
AddStrokeBinding Method (BindingTables Collection)

Examples
' Get the document BindingTables object
Set docBindingTables = Gui.Bindings("Document")

' Assign Stroke to the 2 key


docBindingTables.AddStrokeBinding "14789", "2", BindKey

' Assign Stroke to menu item FitBoard


docBindingTables.AddStrokeBinding "159", "View->FitBoard", BindMenu

' Assign Stroke to a script function


Set bindObj = docBindingTables.AddStrokeBinding( "258", "" ,BindFunction)
bindObj.Target = ScriptEngine
bindObj.ExecuteMethod = "myLaunchDirMethod"

' Assign Stroke to a keyin command


docBindingTables.AddStrokeBinding "951", "run c:\temp\NewUserLayer.vbs",
BindCommand

Common Automation Reference, PADS VX.2.1 97


KeyBind Server
Bindings Property (BindingTables Collection)

Bindings Property (BindingTables Collection)


Object: BindingTables Collection
Access: Read-Only
Returns the collection of keybinding objects of the BindingTables.
Usage
BindingTables.Bindings
Arguments
None.
Return Values
KeyBindings. The collection of KeyBinding objects (KeyBindings) of the BindingTables.

Examples
' Get the document BindingTables object
Set docBindingTables = Gui.Bindings("Document")

' Assign shortcut keys Alt+F1 to Help->Contents->Automation


docBindingTables.AddKeyBinding "Alt+F1", "Help->Contents->Automation",
BindMenu, BindAccelerator

98 Common Automation Reference, PADS VX.2.1


KeyBind Server
Item Property (BindingTables Collection)

Item Property (BindingTables Collection)


Object: BindingTables Collection
Access: Read-Only
Returns a keybinding object contained in the keybindings collection.
Usage
BindingTables.Item (ByVal Index As Variant)
Arguments
Index
Index of the object to retrieve from the collection.
Return Values
KeyBinding. The object (KeyBinding) located at position Index.

Common Automation Reference, PADS VX.2.1 99


KeyBind Server
KeyBindings Collection

KeyBindings Collection
Lists the KeyBindings methods and properties.

Table 5-3. KeyBindings Collection Methods and Properties


Method or Property Description
Remove Method Removes a keybinding object from the
(KeyBindings Collection) keybindings collection.
Count Property Returns the number of keybinding objects
(KeyBindings Collection) contained in the keybindings collection.
Item Property Returns a keybinding object contained in the
(KeyBindings Collection) keybindings collection.

100 Common Automation Reference, PADS VX.2.1


KeyBind Server
Remove Method (KeyBindings Collection)

Remove Method (KeyBindings Collection)


Object: KeyBindings Collection
Removes a keybinding object from the keybindings collection.
Usage
KeyBindings.Remove (ByVal Index As Long)
Arguments
Index
The index of the object (KeyBinding) to remove from the collection.

Common Automation Reference, PADS VX.2.1 101


KeyBind Server
Count Property (KeyBindings Collection)

Count Property (KeyBindings Collection)


Object: KeyBindings Collection
Access: Read-Only
Returns the number of keybinding objects contained in the keybindings collection.
Usage
KeyBindings.Count
Arguments
None.
Return Values
The long number of keybinding objects the collection contains.

102 Common Automation Reference, PADS VX.2.1


KeyBind Server
Item Property (KeyBindings Collection)

Item Property (KeyBindings Collection)


Object: KeyBindings Collection
Access: Read-Only
Returns a keybinding object contained in the keybindings collection.
Usage
KeyBindings.Item (ByVal Index As Variant)
Arguments
Index
Index of the keybinding object to retrieve from the collection.
Return Values
KeyBinding. The object (KeyBinding) located at position Index.

Common Automation Reference, PADS VX.2.1 103


KeyBind Server
Key Binding Enumerated Types

Key Binding Enumerated Types


Lists the KeyBindSvr constants.

Table 5-4. KeyBinding Enumerated Types


Enumerated Type Description
BindKeyType Enum KeyBindSvr Binding Type constants.
BindType Enum KeyBindSvr Binding Key Type constants.

104 Common Automation Reference, PADS VX.2.1


KeyBind Server
BindKeyType Enum

BindKeyType Enum
KeyBindSvr Binding Type constants.
Usage
BindKeyType.Constant
Arguments
Constant
You can specify two types of constants:
BindAccelerator
The value for this constant is 1. Assign the shortcut keys in the accelerator table.
BindKey
The value for this constant is 2. Reserved for future use.

Common Automation Reference, PADS VX.2.1 105


KeyBind Server
BindType Enum

BindType Enum
KeyBindSvr Binding Key Type constants.
Usage
BindType.Constant
Arguments
Constant
You can specify two types of constants:
BindCommand
The value for this constant is 1. Assign the shortcut key or stroke to a key-in
command.
BindFunction
The value for this constant is 2. Assign the shortcut key or stroke to a end-user
function.
BindKeyPress
The value for this constant is 3. Assign the shortcut key or stroke to a key.
BindMenu
The value for this constant is 0. Assign the shortcut key or stroke to a menu
command.

106 Common Automation Reference, PADS VX.2.1


Chapter 6
Addin Controls

The Addin Controls let you include and run add-ins in the applications.
Addin Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Active Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Control Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
ClassID Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Description Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
DisplayName Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Group Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Name Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Placement Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
ProgID Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
ShortCutKey Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Visible Property (Addin Object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Width Property (Addin Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
MGCAddins Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Add Method (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Remove Method (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Count Property (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Item Property (MGCAddins Collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Addins Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
PlacementLocation Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Common Automation Reference, PADS VX.2.1 107


Addin Controls
Addin Object

Addin Object
Lists the Addin object properties.

Table 6-1. Addin Object Properties


Property Description
Active Property (Addin Enable or disable the add-in control.
Object)
Control Property (Addin Returns the control interface of the add-in.
Object)
ClassID Property (Addin Returns the class identifier (CLSID) of the add-in
Object) control.
Description Property Returns the description about the add-in control.
(Addin Object)
DisplayName Property Sets or returns the display name of the add-in
(Addin Object) control.
Group Property (Addin Sets or returns the group name that the add-in
Object) control belongs to.
Name Property (Addin Sets or returns the add-in control instance name.
Object)
Placement Property (Addin Sets or returns the placement location of the add-
Object) in control.
ProgID Property (Addin Returns the programmatic identifier (ProgID) of
Object) the add-in control.
ShortCutKey Property Returns the shortcut keys assigned to the add-in
(Addin Object) control.
Visible Property (Addin Sets or returns the add-in control visible property.
Object)
Width Property (Addin Sets or returns the width of the add-in control.
Object)

108 Common Automation Reference, PADS VX.2.1


Addin Controls
Active Property (Addin Object)

Active Property (Addin Object)


Object: Addin Object
Access: Read\Write
Enable or disable the add-in control.
Usage
Addin.Active = True | False
Arguments
None.
Return Values
Boolean. If True, the Addin object is enabled. False, the Addin object is disabled.

Common Automation Reference, PADS VX.2.1 109


Addin Controls
Control Property (Addin Object)

Control Property (Addin Object)


Object: Addin Object
Access: Read-Only
Returns the control interface of the add-in.
Usage
Addin.Control
Arguments
None.

110 Common Automation Reference, PADS VX.2.1


Addin Controls
ClassID Property (Addin Object)

ClassID Property (Addin Object)


Object: Addin Object
Access: Read-Only
Returns the class identifier (CLSID) of the add-in control.
Usage
Addin.ClassID
Arguments
None.
Return Values
A string that represents the class identifier (CLSID) of the Addin object.

Common Automation Reference, PADS VX.2.1 111


Addin Controls
Description Property (Addin Object)

Description Property (Addin Object)


Object: Addin Object
Access: Read-Only
Returns the description about the add-in control.
Usage
Addin.Description
Arguments
None.
Return Values
A string that contains the description about the add-in control.

112 Common Automation Reference, PADS VX.2.1


Addin Controls
DisplayName Property (Addin Object)

DisplayName Property (Addin Object)


Object: Addin Object
Access: Read\Write
Sets or returns the display name of the add-in control.
Usage
Addin.DisplayName = String
Arguments
None.
Return Values
A string that contains the display name of the add-in control.

Common Automation Reference, PADS VX.2.1 113


Addin Controls
Group Property (Addin Object)

Group Property (Addin Object)


Object: Addin Object
Access: Read\Write
Sets or returns the group name that the add-in control belongs to.
Usage
Addin.Group = String
Arguments
None.
Return Values
A string that contains the group name that the add-in control belongs to.

114 Common Automation Reference, PADS VX.2.1


Addin Controls
Name Property (Addin Object)

Name Property (Addin Object)


Object: Addin Object
Access: Read\Write
Sets or returns the add-in control instance name.
Usage
Addin.Name = String
Arguments
None.
Return Values
A string that contains the add-in control instance name.

Common Automation Reference, PADS VX.2.1 115


Addin Controls
Placement Property (Addin Object)

Placement Property (Addin Object)


Object: Addin Object
Access: Read\Write
Sets or returns the placement location of the add-in control.
Usage
Addin.Placement = PlacementLocation
Arguments
None.
Return Values
PlacementLocation. A long that represents the placement location (PlacementLocation) of the
add-in control.

116 Common Automation Reference, PADS VX.2.1


Addin Controls
ProgID Property (Addin Object)

ProgID Property (Addin Object)


Object: Addin Object
Access: Read-Only
Returns the programmatic identifier (ProgID) of the add-in control.
Usage
Addin.ProgID
Arguments
None.
Return Values
A string that represents the programmatic identifier (ProgID) of the add-in control.

Common Automation Reference, PADS VX.2.1 117


Addin Controls
ShortCutKey Property (Addin Object)

ShortCutKey Property (Addin Object)


Object: Addin Object
Access: Read-Only
Returns the shortcut keys assigned to the add-in control.
Usage
Addin.ShortCutKey
Arguments
None.
Return Values
A string that represents the shortcut keys assigned to the add-in control.

118 Common Automation Reference, PADS VX.2.1


Addin Controls
Visible Property (Addin Object)

Visible Property (Addin Object)


Object: Addin Object
Access: Read\Write
Sets or returns the add-in control visible property.
Usage
Addin.Visible = True | False
Arguments
None.
Return Values
Boolean. If True, the Addin object is visible. If False, the Addin object is not visible.

Description
The default value of this property is determined within the addin. So, you should specifically set
this property value when the addin is loaded.

Examples
Sub ToggleVisibility (nID)
'Called by Hide/Unhide Output Window menu item
If Not outputAddin Is Nothing Then
' Toggle Output Window visibility
If outputAddin.Visible Then
outputAddin.Visible = False
Else
outputAddin.Visible = True
End If
End If
End Sub

Common Automation Reference, PADS VX.2.1 119


Addin Controls
Width Property (Addin Object)

Width Property (Addin Object)


Object: Addin Object
Access: Read\Write
Sets or returns the width of the add-in control.
Usage
Addin.Width
Arguments
None.
Return Values
Integer

120 Common Automation Reference, PADS VX.2.1


Addin Controls
MGCAddins Collection

MGCAddins Collection
Lists the MGCAddins methods and properties.

Table 6-2. MGCAddins Collection Methods and Properties


Method or Property Description
Add Method (MGCAddins Adds an Addin object to the MGCAddins
Collection) collection.
Remove Method Removes an Addin object from the MGCAddins
(MGCAddins Collection) collection.
Count Property Returns the number of Addin objects contained in
(MGCAddins Collection) the MGCAddins collection.
Item Property Returns an Addin object contained in the
(MGCAddins Collection) MGCAddins collection.

Common Automation Reference, PADS VX.2.1 121


Addin Controls
Add Method (MGCAddins Collection)

Add Method (MGCAddins Collection)


Object: MGCAddins Collection
Adds an Addin object to the MGCAddins collection.
Usage
MGCAddins.Add (ByVal ProgIDorClassID As String,
ByVal InstanceID As String,
ByVal AssociatedScript As String,
[ByVal Location As Variant],
[ByVal ShortCutKey As Variant],
[ByVal GroupName As Variant],
[ByVal Quiet As Variant],
[ByVal TbarMenu As Variant]) As Addin
Arguments
ProgIDorClassID
A string that represents the ProgID or the ClassID of the add-in program.
InstanceID
A string that represents the name of the add-in program instance.
AssociatedScript
A string that represents the script will be run when the Addin object is loaded.
Location
(Optional) The placement location (PlacementLocation) of the Addin object when loaded.
ShortCutKey
(Optional) Reserved for future use.
GroupName
(Optional) A string that represents the group name of the Addin object.
Quiet
(Optional) Enable or disable errors reporting when loading Addin object.
TbarMenu
(Optional) Reserved for future use.
Return Values
Addin. The object (Addin) to add to the collection.

122 Common Automation Reference, PADS VX.2.1


Addin Controls
Remove Method (MGCAddins Collection)

Remove Method (MGCAddins Collection)


Object: MGCAddins Collection
Removes an Addin object from the MGCAddins collection.
Usage
MGCAddins.Remove (ByVal Index As Long)
Arguments
Index
The index of the object (Addin) to remove from the collection.

Common Automation Reference, PADS VX.2.1 123


Addin Controls
Count Property (MGCAddins Collection)

Count Property (MGCAddins Collection)


Object: MGCAddins Collection
Access: Read-Only
Returns the number of Addin objects contained in the MGCAddins collection.
Usage
MGCAddins.Count
Arguments
None.
Return Values
Count. The number of Addin objects the collection contains.

124 Common Automation Reference, PADS VX.2.1


Addin Controls
Item Property (MGCAddins Collection)

Item Property (MGCAddins Collection)


Object: MGCAddins Collection
Access: Read-Only
Returns an Addin object contained in the MGCAddins collection.
Usage
MGCAddins.Item (ByVal Index As Variant)
Arguments
Index
Index of the Addin object to retrieve from the collection.
Return Values
Addin. The object (Addin) located at position Index.

Common Automation Reference, PADS VX.2.1 125


Addin Controls
Addins Enumerated Types

Addins Enumerated Types


Lists the Addins types.

Table 6-3. Addins Enumerated Types


Enumerated Type Description
PlacementLocation Enum Addin Object Placement Location Type constants.

126 Common Automation Reference, PADS VX.2.1


Addin Controls
PlacementLocation Enum

PlacementLocation Enum
Addin Object Placement Location Type constants.
Usage
PlacementLocation.Constant
Arguments
Constant
You can specify three types of constants:
PlacementLocationBottom
The value for this constant is 3. Align the add-in control under the design window.
PlacementLocationLeft
The value for this constant is 0. Align the add-in control to the left of the design
window.
PlacementLocationRight
The value for this constant is 2. Align the add-in control to the right of the design
window.
PlacementLocationTop
The value for this constant is 1. Align the add-in control above the design window.

Common Automation Reference, PADS VX.2.1 127


Addin Controls
PlacementLocation Enum

128 Common Automation Reference, PADS VX.2.1


Chapter 7
JScriptHelper

The JScriptHelper object provides additional methods for using JScript to access automation in
Mentor Graphics applications.

JScriptHelper Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130


ToScriptArray Method (JScriptHelper Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Nothing Property (JScriptHelper Object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
JScriptHelper Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

Common Automation Reference, PADS VX.2.1 129


JScriptHelper
JScriptHelper Object

JScriptHelper Object
Lists the JScriptHelper methods and properties.

Table 7-1. JScriptHelper Object Methods and Properties


Method or Property Description
ToScriptArray Method Converts a JScriptArray to a VBArray.
(JScriptHelper Object)
Nothing Property Returns a null object in JScripts.
(JScriptHelper Object)

130 Common Automation Reference, PADS VX.2.1


JScriptHelper
ToScriptArray Method (JScriptHelper Object)

ToScriptArray Method (JScriptHelper Object)


Object: JScriptHelper
Prerequisites: None.
Converts a JScriptArray to a VBArray.
Usage
ScriptHelper.ToScriptArray(JScriptArray) As Object
Arguments
None.
Return Values
Object. Returns a VBArray that has been converted from a JScriptArray.

Description
In order to pass a points array (often used to create new design objects defined by a geometry),
you must convert any JScriptArrays to VBArrays.

Common Automation Reference, PADS VX.2.1 131


JScriptHelper
Nothing Property (JScriptHelper Object)

Nothing Property (JScriptHelper Object)


Object: JScriptHelper
Access: Read-Only
Prerequisites: None.
Returns a null object in JScripts.
Usage
ScriptHelper.Nothing As Object
Arguments
None.
Return Values
Object. A null object.

Description
Currently, there is no null object available within JScript, even though many Mentor Graphics
methods require it.

JScriptHelper Example
The following is an example that shows the use of the JScriptHelper method and property.

132 Common Automation Reference, PADS VX.2.1


JScriptHelper
JScriptHelper Example

// This example shows how you can use JScriptHelper to convert an array to
a
// VBArray which you can then pass to other Mentor Grapics apis.

// add any type librarys to be used.


Scripting.AddTypeLibrary("MGCPCB.ExpeditionPCBApplication");
Scripting.AddTypeLibrary("Scripting.FileSystemObject");

// Get the application object


var pcbApp = Application;

// Get the active document


var pcbDoc = pcbApp.ActiveDocument;

// Server validation function


// License the document
ValidateServer(pcbDoc);
var oHelper = Scripting.CreateObject("JScriptHelper.ScriptHelper");

var obj = oHelper.Nothing;


if(obj == oHelper.Nothing)
obj = pcbDoc.ConductorLayerGfxs2(0, epcbSelectSelected).Item(1);
if(obj==oHelper.Nothing)
obj = pcbDoc.FabricationLayerGfxs(epcbFabAll,
epcbSelectSelected).Item(1);
if(obj==oHelper.Nothing)
obj = pcbDoc.UserLayerGfxs(epcbSelectSelected).Item(1);

// Get an array from the interface


var arr = obj.Geometry.PointsArray;

// Convert it to a JScript array.


var jArr = ToJPntsArray(arr);

// Once you have a jArr you can manipulate it in JScript.

// Display the JScript array


pcbApp.Gui.Display(GetPointsArrayString(jArr));

// Once you have a JScript array, you can use JScript to modify the array.
This
// function uses JScript functionality to modify all elements of a JScript
array.
// Assume jArr is an initialized JScript array.
for (i = 0; i < jArr[0].length; i++)
{
jArr[0][i] = parseFloat(jArr[0][i]) + 100;
}
// Before passing the array back to the interface convert
// it back to a SAFEARRAY. This can be done inline.

// Use the shifted points to create user layer gfxs.


var userLayerGfx = pcbDoc.PutUserLayerGfx(pcbDoc.UserLayers.Item(1), 0,
jArr[0].length, ToSafePntsArray(jArr), false, oHelper.Nothing,
epcbUnitCurrent)
userLayerGfx.Selected = true

Common Automation Reference, PADS VX.2.1 133


JScriptHelper
JScriptHelper Example

// Notice that JScriptHelper is used with the PutUserLayerGfx function


call.
// Also notice that the oHelper (JScriptHelper) specifies Nothing (the
property)
// for the interface. Nothing is not a keyword in JScript, but is needed
in
// many Mentor Graphics automation functions.

//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//Local functions

function ToSafePntsArray(jArr)
{
return oHelper.ToSafeArray(jArr);
}

// This function converts a VBArray to a two-dimensional JScript array.


Note
// that this function does not require JScriptHelper, but uses inherent
JScript
// functionality.
function ToJPntsArray(VBArr)
{
// Create a VBArray object
var vbArr = new VBArray(VBArr)

// Convert it a a single dimension JArray


var jsArrSingelDim = vbArr.toArray();

// Make the single dim array into a multidimensional array.


// assumes there are 2 dimensions with 3 rows in the first dimension
var numPnts = jsArrSingelDim.length / 3;
var i;
var arr = new Array(3);
arr[0] = new Array(numPnts);
arr[1] = new Array(numPnts);
arr[2] = new Array(numPnts);
for (i = 0; i < numPnts; i++)
{
arr[0][i] = parseFloat(jsArrSingelDim[i*3]);
arr[1][i] = parseFloat(jsArrSingelDim[i*3+1]);
arr[2][i] = parseFloat(jsArrSingelDim[i*3+2]);
}

return arr;
}

// This function reads a JScript array into a stream format so that it can
be
// displayed or output.
function GetPointsArrayString(pnts)
{
var i,j;
var str="";
for(i = 0; i<pnts[0].length; i++) {
str = str + "(" + pnts[0][i];
str = str + "," + pnts[1][i];
str = str + "," + pnts[2][i] + ")";

134 Common Automation Reference, PADS VX.2.1


JScriptHelper
JScriptHelper Example

str = str + '

}
return str;
}

// Server validation function


function ValidateServer(docObj) {

var keyInt;
var licenseTokenInt;
var licenseServerObj;
var retValInt = 1;

// Ask xPCB Layouts document for the key;


keyInt = docObj.Validate(0);

// Get license server;


licenseServerObj = new
ActiveXObject("MGCPCBAutomationLicensing.Application");

// Ask the license server for the license token;


licenseTokenInt = licenseServerObj.GetToken(keyInt);

// Release license server;


licenseServerObj = null;

// Check for error in Validate


try {
// Ask the document to validate the license token;
docObj.Validate(licenseTokenInt);
} catch(err) {
retValInt = 0
}

return retValInt;
}

Common Automation Reference, PADS VX.2.1 135


JScriptHelper
JScriptHelper Example

136 Common Automation Reference, PADS VX.2.1


Third-Party Information
For third-party information, refer to

Third-Party Software
End-User License Agreement
The latest version of the End-User License Agreement is available on-line at:
www.mentor.com/eula

IMPORTANT INFORMATION

USE OF ALL SOFTWARE IS SUBJECT TO LICENSE RESTRICTIONS. CAREFULLY READ THIS LICENSE
AGREEMENT BEFORE USING THE PRODUCTS. USE OF SOFTWARE INDICATES CUSTOMERS COMPLETE
AND UNCONDITIONAL ACCEPTANCE OF THE TERMS AND CONDITIONS SET FORTH IN THIS AGREEMENT.
ANY ADDITIONAL OR DIFFERENT PURCHASE ORDER TERMS AND CONDITIONS SHALL NOT APPLY.

END-USER LICENSE AGREEMENT (Agreement)

This is a legal agreement concerning the use of Software (as defined in Section 2) and hardware (collectively Products)
between the company acquiring the Products (Customer), and the Mentor Graphics entity that issued the corresponding
quotation or, if no quotation was issued, the applicable local Mentor Graphics entity (Mentor Graphics). Except for license
agreements related to the subject matter of this license agreement which are physically signed by Customer and an authorized
representative of Mentor Graphics, this Agreement and the applicable quotation contain the parties entire understanding
relating to the subject matter and supersede all prior or contemporaneous agreements. If Customer does not agree to these
terms and conditions, promptly return or, in the case of Software received electronically, certify destruction of Software and all
accompanying items within five days after receipt of Software and receive a full refund of any license fee paid.

1. ORDERS, FEES AND PAYMENT.

1.1. To the extent Customer (or if agreed by Mentor Graphics, Customers appointed third party buying agent) places and Mentor
Graphics accepts purchase orders pursuant to this Agreement (each an Order), each Order will constitute a contract between
Customer and Mentor Graphics, which shall be governed solely and exclusively by the terms and conditions of this Agreement,
any applicable addenda and the applicable quotation, whether or not those documents are referenced on the Order. Any
additional or conflicting terms and conditions appearing on an Order or presented in any electronic portal or automated order
management system, whether or not required to be electronically accepted, will not be effective unless agreed in writing and
physically signed by an authorized representative of Customer and Mentor Graphics.

1.2. Amounts invoiced will be paid, in the currency specified on the applicable invoice, within 30 days from the date of such invoice.
Any past due invoices will be subject to the imposition of interest charges in the amount of one and one-half percent per month
or the applicable legal rate currently in effect, whichever is lower. Prices do not include freight, insurance, customs duties, taxes
or other similar charges, which Mentor Graphics will state separately in the applicable invoice. Unless timely provided with a
valid certificate of exemption or other evidence that items are not taxable, Mentor Graphics will invoice Customer for all
applicable taxes including, but not limited to, VAT, GST, sales tax, consumption tax and service tax. Customer will make all
payments free and clear of, and without reduction for, any withholding or other taxes; any such taxes imposed on payments by
Customer hereunder will be Customers sole responsibility. If Customer appoints a third party to place purchase orders and/or
make payments on Customers behalf, Customer shall be liable for payment under Orders placed by such third party in the event
of default.

1.3. All Products are delivered FCA factory (Incoterms 2010), freight prepaid and invoiced to Customer, except Software delivered
electronically, which shall be deemed delivered when made available to Customer for download. Mentor Graphics retains a
security interest in all Products delivered under this Agreement, to secure payment of the purchase price of such Products, and
Customer agrees to sign any documents that Mentor Graphics determines to be necessary or convenient for use in filing or
perfecting such security interest. Mentor Graphics delivery of Software by electronic means is subject to Customers provision
of both a primary and an alternate e-mail address.

2. GRANT OF LICENSE. The software installed, downloaded, or otherwise acquired by Customer under this Agreement, including any
updates, modifications, revisions, copies, documentation, setup files and design data (Software) are copyrighted, trade secret and
confidential information of Mentor Graphics or its licensors, who maintain exclusive title to all Software and retain all rights not
expressly granted by this Agreement. Except for Software that is embeddable (Embedded Software), which is licensed pursuant to
separate embedded software terms or an embedded software supplement, Mentor Graphics grants to Customer, subject to payment of
applicable license fees, a nontransferable, nonexclusive license to use Software solely: (a) in machine-readable, object-code form
(except as provided in Subsection 4.2); (b) for Customers internal business purposes; (c) for the term of the license; and (d) on the
computer hardware and at the site authorized by Mentor Graphics. A site is restricted to a one-half mile (800 meter) radius. Customer
may have Software temporarily used by an employee for telecommuting purposes from locations other than a Customer office, such as
the employees residence, an airport or hotel, provided that such employees primary place of employment is the site where the
Software is authorized for use. Mentor Graphics standard policies and programs, which vary depending on Software, license fees paid
or services purchased, apply to the following: (a) relocation of Software; (b) use of Software, which may be limited, for example, to
execution of a single session by a single user on the authorized hardware or for a restricted period of time (such limitations may be
technically implemented through the use of authorization codes or similar devices); and (c) support services provided, including
eligibility to receive telephone support, updates, modifications, and revisions. For the avoidance of doubt, if Customer provides any
feedback or requests any change or enhancement to Products, whether in the course of receiving support or consulting services,
evaluating Products, performing beta testing or otherwise, any inventions, product improvements, modifications or developments made
by Mentor Graphics (at Mentor Graphics sole discretion) will be the exclusive property of Mentor Graphics.
3. BETA CODE.

3.1. Portions or all of certain Software may contain code for experimental testing and evaluation (which may be either alpha or beta,
collectively Beta Code), which may not be used without Mentor Graphics explicit authorization. Upon Mentor Graphics
authorization, Mentor Graphics grants to Customer a temporary, nontransferable, nonexclusive license for experimental use to
test and evaluate the Beta Code without charge for a limited period of time specified by Mentor Graphics. Mentor Graphics may
choose, at its sole discretion, not to release Beta Code commercially in any form.

3.2. If Mentor Graphics authorizes Customer to use the Beta Code, Customer agrees to evaluate and test the Beta Code under normal
conditions as directed by Mentor Graphics. Customer will contact Mentor Graphics periodically during Customers use of the
Beta Code to discuss any malfunctions or suggested improvements. Upon completion of Customers evaluation and testing,
Customer will send to Mentor Graphics a written evaluation of the Beta Code, including its strengths, weaknesses and
recommended improvements.

3.3. Customer agrees to maintain Beta Code in confidence and shall restrict access to the Beta Code, including the methods and
concepts utilized therein, solely to those employees and Customer location(s) authorized by Mentor Graphics to perform beta
testing. Customer agrees that any written evaluations and all inventions, product improvements, modifications or developments
that Mentor Graphics conceived or made during or subsequent to this Agreement, including those based partly or wholly on
Customers feedback, will be the exclusive property of Mentor Graphics. Mentor Graphics will have exclusive rights, title and
interest in all such property. The provisions of this Subsection 3.3 shall survive termination of this Agreement.

4. RESTRICTIONS ON USE.

4.1. Customer may copy Software only as reasonably necessary to support the authorized use. Each copy must include all notices
and legends embedded in Software and affixed to its medium and container as received from Mentor Graphics. All copies shall
remain the property of Mentor Graphics or its licensors. Except for Embedded Software that has been embedded in executable
code form in Customers product(s), Customer shall maintain a record of the number and primary location of all copies of
Software, including copies merged with other software, and shall make those records available to Mentor Graphics upon
request. Customer shall not make Products available in any form to any person other than Customers employees and on-site
contractors, excluding Mentor Graphics competitors, whose job performance requires access and who are under obligations of
confidentiality. Customer shall take appropriate action to protect the confidentiality of Products and ensure that any person
permitted access does not disclose or use Products except as permitted by this Agreement. Customer shall give Mentor Graphics
written notice of any unauthorized disclosure or use of the Products as soon as Customer becomes aware of such unauthorized
disclosure or use. Customer acknowledges that Software provided hereunder may contain source code which is proprietary and
its confidentiality is of the highest importance and value to Mentor Graphics. Customer acknowledges that Mentor Graphics
may be seriously harmed if such source code is disclosed in violation of this Agreement. Except as otherwise permitted for
purposes of interoperability as specified by applicable and mandatory local law, Customer shall not reverse-assemble,
disassemble, reverse-compile, or reverse-engineer any Product, or in any way derive any source code from Software that is not
provided to Customer in source code form. Log files, data files, rule files and script files generated by or for the Software
(collectively Files), including without limitation files containing Standard Verification Rule Format (SVRF) and Tcl
Verification Format (TVF) which are Mentor Graphics trade secret and proprietary syntaxes for expressing process rules,
constitute or include confidential information of Mentor Graphics. Customer may share Files with third parties, excluding
Mentor Graphics competitors, provided that the confidentiality of such Files is protected by written agreement at least as well as
Customer protects other information of a similar nature or importance, but in any case with at least reasonable care. Customer
may use Files containing SVRF or TVF only with Mentor Graphics products. Under no circumstances shall Customer use
Products or Files or allow their use for the purpose of developing, enhancing or marketing any product that is in any way
competitive with Products, or disclose to any third party the results of, or information pertaining to, any benchmark.

4.2. If any Software or portions thereof are provided in source code form, Customer will use the source code only to correct software
errors and enhance or modify the Software for the authorized use, or as permitted for Embedded Software under separate
embedded software terms or an embedded software supplement. Customer shall not disclose or permit disclosure of source
code, in whole or in part, including any of its methods or concepts, to anyone except Customers employees or on-site
contractors, excluding Mentor Graphics competitors, with a need to know. Customer shall not copy or compile source code in
any manner except to support this authorized use.

4.3. Customer agrees that it will not subject any Product to any open source software (OSS) license that conflicts with this
Agreement or that does not otherwise apply to such Product.

4.4. Customer may not assign this Agreement or the rights and duties under it, or relocate, sublicense, or otherwise transfer the
Products, whether by operation of law or otherwise (Attempted Transfer), without Mentor Graphics prior written consent and
payment of Mentor Graphics then-current applicable relocation and/or transfer fees. Any Attempted Transfer without Mentor
Graphics prior written consent shall be a material breach of this Agreement and may, at Mentor Graphics option, result in the
immediate termination of the Agreement and/or the licenses granted under this Agreement. The terms of this Agreement,
including without limitation the licensing and assignment provisions, shall be binding upon Customers permitted successors in
interest and assigns.

4.5. The provisions of this Section 4 shall survive the termination of this Agreement.

5. SUPPORT SERVICES. To the extent Customer purchases support services, Mentor Graphics will provide Customer with updates and
technical support for the Products, at the Customer site(s) for which support is purchased, in accordance with Mentor Graphics then
current End-User Support Terms located at http://supportnet.mentor.com/supportterms.

6. OPEN SOURCE SOFTWARE. Products may contain OSS or code distributed under a proprietary third party license agreement, to
which additional rights or obligations (Third Party Terms) may apply. Please see the applicable Product documentation (including
license files, header files, read-me files or source code) for details. In the event of conflict between the terms of this Agreement
(including any addenda) and the Third Party Terms, the Third Party Terms will control solely with respect to the OSS or third party
code. The provisions of this Section 6 shall survive the termination of this Agreement.

7. LIMITED WARRANTY.

7.1. Mentor Graphics warrants that during the warranty period its standard, generally supported Products, when properly installed,
will substantially conform to the functional specifications set forth in the applicable user manual. Mentor Graphics does not
warrant that Products will meet Customers requirements or that operation of Products will be uninterrupted or error free. The
warranty period is 90 days starting on the 15th day after delivery or upon installation, whichever first occurs. Customer must
notify Mentor Graphics in writing of any nonconformity within the warranty period. For the avoidance of doubt, this warranty
applies only to the initial shipment of Software under an Order and does not renew or reset, for example, with the delivery of (a)
Software updates or (b) authorization codes or alternate Software under a transaction involving Software re-mix. This warranty
shall not be valid if Products have been subject to misuse, unauthorized modification, improper installation or Customer is not in
compliance with this Agreement. MENTOR GRAPHICS ENTIRE LIABILITY AND CUSTOMERS EXCLUSIVE
REMEDY SHALL BE, AT MENTOR GRAPHICS OPTION, EITHER (A) REFUND OF THE PRICE PAID UPON
RETURN OF THE PRODUCTS TO MENTOR GRAPHICS OR (B) MODIFICATION OR REPLACEMENT OF THE
PRODUCTS THAT DO NOT MEET THIS LIMITED WARRANTY. MENTOR GRAPHICS MAKES NO WARRANTIES
WITH RESPECT TO: (A) SERVICES; (B) PRODUCTS PROVIDED AT NO CHARGE; OR (C) BETA CODE; ALL OF
WHICH ARE PROVIDED AS IS.

7.2. THE WARRANTIES SET FORTH IN THIS SECTION 7 ARE EXCLUSIVE. NEITHER MENTOR GRAPHICS NOR ITS
LICENSORS MAKE ANY OTHER WARRANTIES EXPRESS, IMPLIED OR STATUTORY, WITH RESPECT TO
PRODUCTS PROVIDED UNDER THIS AGREEMENT. MENTOR GRAPHICS AND ITS LICENSORS SPECIFICALLY
DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY.

8. LIMITATION OF LIABILITY. TO THE EXTENT PERMITTED UNDER APPLICABLE LAW, IN NO EVENT SHALL
MENTOR GRAPHICS OR ITS LICENSORS BE LIABLE FOR INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES (INCLUDING LOST PROFITS OR SAVINGS) WHETHER BASED ON CONTRACT, TORT OR ANY OTHER
LEGAL THEORY, EVEN IF MENTOR GRAPHICS OR ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES. IN NO EVENT SHALL MENTOR GRAPHICS OR ITS LICENSORS LIABILITY UNDER THIS
AGREEMENT EXCEED THE AMOUNT RECEIVED FROM CUSTOMER FOR THE HARDWARE, SOFTWARE LICENSE OR
SERVICE GIVING RISE TO THE CLAIM. IN THE CASE WHERE NO AMOUNT WAS PAID, MENTOR GRAPHICS AND ITS
LICENSORS SHALL HAVE NO LIABILITY FOR ANY DAMAGES WHATSOEVER. THE PROVISIONS OF THIS SECTION 8
SHALL SURVIVE THE TERMINATION OF THIS AGREEMENT.

9. THIRD PARTY CLAIMS.

9.1. Customer acknowledges that Mentor Graphics has no control over the testing of Customers products, or the specific
applications and use of Products. Mentor Graphics and its licensors shall not be liable for any claim or demand made against
Customer by any third party, except to the extent such claim is covered under Section 10.

9.2. In the event that a third party makes a claim against Mentor Graphics arising out of the use of Customers products, Mentor
Graphics will give Customer prompt notice of such claim. At Customers option and expense, Customer may take sole control
of the defense and any settlement of such claim. Customer WILL reimburse and hold harmless Mentor Graphics for any
LIABILITY, damages, settlement amounts, costs and expenses, including reasonable attorneys fees, incurred by or awarded
against Mentor Graphics or its licensors in connection with such claims.

9.3. The provisions of this Section 9 shall survive any expiration or termination of this Agreement.

10. INFRINGEMENT.

10.1. Mentor Graphics will defend or settle, at its option and expense, any action brought against Customer in the United States,
Canada, Japan, or member state of the European Union which alleges that any standard, generally supported Product acquired
by Customer hereunder infringes a patent or copyright or misappropriates a trade secret in such jurisdiction. Mentor Graphics
will pay costs and damages finally awarded against Customer that are attributable to such action. Customer understands and
agrees that as conditions to Mentor Graphics obligations under this section Customer must: (a) notify Mentor Graphics
promptly in writing of the action; (b) provide Mentor Graphics all reasonable information and assistance to settle or defend the
action; and (c) grant Mentor Graphics sole authority and control of the defense or settlement of the action.

10.2. If a claim is made under Subsection 10.1 Mentor Graphics may, at its option and expense: (a) replace or modify the Product so
that it becomes noninfringing; (b) procure for Customer the right to continue using the Product; or (c) require the return of the
Product and refund to Customer any purchase price or license fee paid, less a reasonable allowance for use.

10.3. Mentor Graphics has no liability to Customer if the action is based upon: (a) the combination of Software or hardware with any
product not furnished by Mentor Graphics; (b) the modification of the Product other than by Mentor Graphics; (c) the use of
other than a current unaltered release of Software; (d) the use of the Product as part of an infringing process; (e) a product that
Customer makes, uses, or sells; (f) any Beta Code or Product provided at no charge; (g) any software provided by Mentor
Graphics licensors who do not provide such indemnification to Mentor Graphics customers; (h) OSS, except to the extent that
the infringement is directly caused by Mentor Graphics modifications to such OSS; or (i) infringement by Customer that is
deemed willful. In the case of (i), Customer shall reimburse Mentor Graphics for its reasonable attorney fees and other costs
related to the action.

10.4. THIS SECTION 10 IS SUBJECT TO SECTION 8 ABOVE AND STATES THE ENTIRE LIABILITY OF MENTOR
GRAPHICS AND ITS LICENSORS, AND CUSTOMERS SOLE AND EXCLUSIVE REMEDY, FOR DEFENSE,
SETTLEMENT AND DAMAGES, WITH RESPECT TO ANY ALLEGED PATENT OR COPYRIGHT INFRINGEMENT
OR TRADE SECRET MISAPPROPRIATION BY ANY PRODUCT PROVIDED UNDER THIS AGREEMENT.

11. TERMINATION AND EFFECT OF TERMINATION.

11.1. If a Software license was provided for limited term use, such license will automatically terminate at the end of the authorized
term. Mentor Graphics may terminate this Agreement and/or any license granted under this Agreement immediately upon
written notice if Customer: (a) exceeds the scope of the license or otherwise fails to comply with the licensing or confidentiality
provisions of this Agreement, or (b) becomes insolvent, files a bankruptcy petition, institutes proceedings for liquidation or
winding up or enters into an agreement to assign its assets for the benefit of creditors. For any other material breach of any
provision of this Agreement, Mentor Graphics may terminate this Agreement and/or any license granted under this Agreement
upon 30 days written notice if Customer fails to cure the breach within the 30 day notice period. Termination of this Agreement
or any license granted hereunder will not affect Customers obligation to pay for Products shipped or licenses granted prior to
the termination, which amounts shall be payable immediately upon the date of termination.

11.2. Upon termination of this Agreement, the rights and obligations of the parties shall cease except as expressly set forth in this
Agreement. Upon termination of this Agreement and/or any license granted under this Agreement, Customer shall ensure that
all use of the affected Products ceases, and shall return hardware and either return to Mentor Graphics or destroy Software in
Customers possession, including all copies and documentation, and certify in writing to Mentor Graphics within ten business
days of the termination date that Customer no longer possesses any of the affected Products or copies of Software in any form.

12. EXPORT. The Products provided hereunder are subject to regulation by local laws and European Union (E.U.) and United States
(U.S.) government agencies, which prohibit export, re-export or diversion of certain products, information about the products, and
direct or indirect products thereof, to certain countries and certain persons. Customer agrees that it will not export or re-export Products
in any manner without first obtaining all necessary approval from appropriate local, E.U. and U.S. government agencies. If Customer
wishes to disclose any information to Mentor Graphics that is subject to any E.U., U.S. or other applicable export restrictions, including
without limitation the U.S. International Traffic in Arms Regulations (ITAR) or special controls under the Export Administration
Regulations (EAR), Customer will notify Mentor Graphics personnel, in advance of each instance of disclosure, that such information
is subject to such export restrictions.

13. U.S. GOVERNMENT LICENSE RIGHTS. Software was developed entirely at private expense. The parties agree that all Software is
commercial computer software within the meaning of the applicable acquisition regulations. Accordingly, pursuant to U.S. FAR 48
CFR 12.212 and DFAR 48 CFR 227.7202, use, duplication and disclosure of the Software by or for the U.S. government or a U.S.
government subcontractor is subject solely to the terms and conditions set forth in this Agreement, which shall supersede any
conflicting terms or conditions in any government order document, except for provisions which are contrary to applicable mandatory
federal laws.

14. THIRD PARTY BENEFICIARY. Mentor Graphics Corporation, Mentor Graphics (Ireland) Limited, Microsoft Corporation and
other licensors may be third party beneficiaries of this Agreement with the right to enforce the obligations set forth herein.

15. REVIEW OF LICENSE USAGE. Customer will monitor the access to and use of Software. With prior written notice and during
Customers normal business hours, Mentor Graphics may engage an internationally recognized accounting firm to review Customers
software monitoring system and records deemed relevant by the internationally recognized accounting firm to confirm Customers
compliance with the terms of this Agreement or U.S. or other local export laws. Such review may include FlexNet (or successor
product) report log files that Customer shall capture and provide at Mentor Graphics request. Customer shall make records available in
electronic format and shall fully cooperate with data gathering to support the license review. Mentor Graphics shall bear the expense of
any such review unless a material non-compliance is revealed. Mentor Graphics shall treat as confidential information all information
gained as a result of any request or review and shall only use or disclose such information as required by law or to enforce its rights
under this Agreement. The provisions of this Section 15 shall survive the termination of this Agreement.

16. CONTROLLING LAW, JURISDICTION AND DISPUTE RESOLUTION. The owners of certain Mentor Graphics intellectual
property licensed under this Agreement are located in Ireland and the U.S. To promote consistency around the world, disputes shall be
resolved as follows: excluding conflict of laws rules, this Agreement shall be governed by and construed under the laws of the State of
Oregon, U.S., if Customer is located in North or South America, and the laws of Ireland if Customer is located outside of North or
South America or Japan, and the laws of Japan if Customer is located in Japan. All disputes arising out of or in relation to this
Agreement shall be submitted to the exclusive jurisdiction of the courts of Portland, Oregon when the laws of Oregon apply, or Dublin,
Ireland when the laws of Ireland apply, or the Tokyo District Court when the laws of Japan apply. Notwithstanding the foregoing, all
disputes in Asia (excluding Japan) arising out of or in relation to this Agreement shall be resolved by arbitration in Singapore before a
single arbitrator to be appointed by the chairman of the Singapore International Arbitration Centre (SIAC) to be conducted in the
English language, in accordance with the Arbitration Rules of the SIAC in effect at the time of the dispute, which rules are deemed to be
incorporated by reference in this section. Nothing in this section shall restrict Mentor Graphics right to bring an action (including for
example a motion for injunctive relief) against Customer in the jurisdiction where Customers place of business is located. The United
Nations Convention on Contracts for the International Sale of Goods does not apply to this Agreement.

17. SEVERABILITY. If any provision of this Agreement is held by a court of competent jurisdiction to be void, invalid, unenforceable or
illegal, such provision shall be severed from this Agreement and the remaining provisions will remain in full force and effect.

18. MISCELLANEOUS. This Agreement contains the parties entire understanding relating to its subject matter and supersedes all prior
or contemporaneous agreements. Any translation of this Agreement is provided to comply with local legal requirements only. In the
event of a dispute between the English and any non-English versions, the English version of this Agreement shall govern to the extent
not prohibited by local law in the applicable jurisdiction. This Agreement may only be modified in writing, signed by an authorized
representative of each party. Waiver of terms or excuse of breach must be in writing and shall not constitute subsequent consent, waiver
or excuse.

Rev. 151102, Part No. 265968

Anda mungkin juga menyukai