0% found this document useful (0 votes)
1K views

NX Open Programming

This document provides an overview and introduction to NX Open and describes its object model, toolkits, modes of operation and licensing. It also covers topics like journaling, turning journals into applications, and NX Open programming. The document is intended for programmers interested in learning about and using NX Open.

Uploaded by

gsgsuresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

NX Open Programming

This document provides an overview and introduction to NX Open and describes its object model, toolkits, modes of operation and licensing. It also covers topics like journaling, turning journals into applications, and NX Open programming. The document is intended for programmers interested in learning about and using NX Open.

Uploaded by

gsgsuresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Contents

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Course Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Course Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
How to use this course . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
NX Help Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
The Learning Advantage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Class Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Student responsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Part naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Classroom system information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Automation Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6

About NX Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1


Available toolkits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Common API toolkits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Legacy API toolkits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Additional toolkits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
Licensing for common API objects . . . . . . . . . . . . . . . . . . . . . . . . 2-8
NX Open API signing tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Determining license requirement . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Finding help and code samples . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
NX installed help documentation . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
NX Installed code samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17

NX Open API Programming 3


Contents

NX Open Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1


The Common API Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Browsing the Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
The Visual Studio Object Browser . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Activity: The Visual Studio Object Browser . . . . . . . . . . . . . . . . . . 3-5
The Eclipse Package Explorer . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Activity: The Eclipse Package Explorer . . . . . . . . . . . . . . . . . . . . 3-8
Documentation Object Model browsers . . . . . . . . . . . . . . . . . . . . . 3-9
API code examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
Creating features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
Editing features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Info Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16

Journaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Using journals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Setting journal preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Recording . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Playing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Inserting a User Pause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Inserting a comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
Inserting user-defined code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
Functionality coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
Activity: creating a journal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Creating a journal from scratch . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Running a journal from the NX command prompt window . . . . . 4-17
Journaling options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
Journal toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19
Journal manager dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Journal editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Journaling related topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22
Warning messages and handling exceptions . . . . . . . . . . . . . . . 4-23
Adjusting internet zone activity . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24
.NET Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
Localization and internationalization . . . . . . . . . . . . . . . . . . . . . . . 4-26
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-28

Turning journals into applications . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1


Turning journals into applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Menuscript support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Using native Window tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
Adding a journal to a toolbar button . . . . . . . . . . . . . . . . . . . . . . 5-7
Removing selection stickiness . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8

4 NX Open API Programming mt13110 s NX 7.5


Contents

Debugging journals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12


Activity: Using native Window tools . . . . . . . . . . . . . . . . . . . . . 5-13
Activity: Adding a Journal to a toolbar button . . . . . . . . . . . . . . . 5-15
Activity: Removing selection stickiness . . . . . . . . . . . . . . . . . . . 5-18
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21

NX Open Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1


Environment settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Application root directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Unload options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8
Activity: Feature Selection – Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13
Activity: Feature Selection – VB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-16
User Exits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-21
User Exits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22
Activity: User Exit Create Part – Java . . . . . . . . . . . . . . . . . . . . . 6-25
Activity: User Exit Create Part – VB . . . . . . . . . . . . . . . . . . . . . . . 6-27
Activity: User Exit Save Part – VB . . . . . . . . . . . . . . . . . . . . . .6-29
UDO – User Defined Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31
UDO Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31
Sample Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-33
Links to NX Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-35
Activity: UDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-38
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-44

Execution Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1


Journals and the Journal Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Interactive NX (File → Execute → NX Open...) . . . . . . . . . . . . . . . . . . . . 7-3
Programs, Journals, or Callbacks from New Menu Items . . . . . . . . . . . . . 7-4
Executing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
Executing Journals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
Executing Callbacks (Menu Event Handlers) . . . . . . . . . . . . . . . 7-11
Programs, Journals, or Callbacks from Existing Menu Items . . . . . . . . . 7-14
Applications from a Toolbar Button (interactive) . . . . . . . . . . . . . . . . . . . 7-22
Applications from a Toolbar File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24
Automatically at NX Start up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-26
Adding Custom Applications to NX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-27
User Exits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-31
Executing Batch Applications with a Command Line . . . . . . . . . . . . . . . 7-32
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-34

NX Open API Programming 5


Contents

User Interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1


Block Styler Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Why use Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Block Styler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5
Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
Block Styler user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7
Code generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12
Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13
Block Styler Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14
Launching Block Styler Dialogs from NX . . . . . . . . . . . . . . . . . . . . . . . 8-17
Finding the DLX File at Runtime . . . . . . . . . . . . . . . . . . . . . . . 8-18
Entry Point Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19
Block Styler Memory and Callbacks . . . . . . . . . . . . . . . . . . . . . . 8-24
Dialog and Block Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-29
Block Styler Selection Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-33
OK and Apply Button Management . . . . . . . . . . . . . . . . . . . . . . 8-34
Update Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-35
NX Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-36
Selection Blocks - Language Specific Details . . . . . . . . . . . . . . . 8-37
NX Open for .NET - Selection Blocks . . . . . . . . . . . . . . . . . . . . . 8-38
NX Open for Java - Selection Blocks . . . . . . . . . . . . . . . . . . . . . 8-38
Block Styler Update Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-39
Determining Which Block Called the Update Callback . . . . . . . . 8-40
Update Callback - Language Specific Details . . . . . . . . . . . . . . . 8-41
NX Open for .NET - Dialog and Block Properties . . . . . . . . . . . . 8-42
NX Open for Java - Dialog and Block Properties . . . . . . . . . . . . . 8-44
Microsoft Windows Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-46
Unload Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-46
Activity: Windows Forms – VB . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-47
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-49

Configuring Visual Studio for Visual Basic .NET and C# . . . . . . . . . .A-1


How to set up Visual Studio .NET for developing an NX Open application or
Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3
General steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-4
Brief Description of NX Open Assemblies . . . . . . . . . . . . . . . . . . A-12
Activity: Sample Visual Basic .NET project . . . . . . . . . . . . . . . . . . . . . . . A-13

6 NX Open API Programming mt13110 s NX 7.5


Contents

Open C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-1
Interoperation between Open C and common API . . . . . . . . . . . . . . . . . B-2
Wrappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3
Wrappers - Language Specific Examples . . . . . . . . . . . . . . . . . . B-4
Mapping Open C to NX Open Common API . . . . . . . . . . . . . . . . . B-6
Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-27
Assembly terminology and concepts . . . . . . . . . . . . . . . . . . . . . . B-28
Sample assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-30
Coordinate systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-34
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-35
Expression definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-36
Conditional expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-37
Expression routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-38
Mapping from Open C to NX Open for .NET online Help . . . . . . . . . . . . 9-66

Configuring Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1


Setting up Java for NX Open development . . . . . . . . . . . . . . . . . . . . . . . C-2
Setting up the Java runtime environment . . . . . . . . . . . . . . . . . . . C-3
Using Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-4

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1

NX Open API Programming 7

You might also like