Creo 3.0 Jlinkug
Creo 3.0 Jlinkug
Creo 3.0 Jlinkug
0
J-Link User’s Guide
Datecode M090
Copyright © 2016 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
User and training guides and related documentation from PTC Inc. and its subsidiary companies (collectively
"PTC") are subject to the copyright laws of the United States and other countries and are provided under a
license agreement that restricts copying, disclosure, and use of such documentation. PTC hereby grants to the
licensed software user the right to make copies in printed form of this documentation if provided on software
media, but only for internal/personal use and in accordance with the license agreement under which the
applicable software is licensed. Any copy made shall include the PTC copyright notice and any other
proprietary notice provided by PTC. Training materials may not be copied without the express written consent
of PTC. This documentation may not be disclosed, transferred, modified, or reduced to any form, including
electronic media, or transmitted or made publicly available by any means without the prior written consent of
PTC and no authorization is granted to make copies for such purposes. Information described herein is
furnished for general information only, is subject to change without notice, and should not be construed as a
warranty or commitment by PTC. PTC assumes no responsibility or liability for any errors or inaccuracies
that may appear in this document.
The software described in this document is provided under written license agreement, contains valuable trade
secrets and proprietary information, and is protected by the copyright laws of the United States and other
countries. It may not be copied or distributed in any form or medium, disclosed to third parties, or used in any
manner not provided for in the software licenses agreement except with written prior approval from PTC.
PTC regards software piracy as the crime it is, and we view offenders accordingly. We do not tolerate the
piracy of PTC software products, and we pursue (both civilly and criminally) those who do so using all legal
means available, including public and private surveillance resources. As part of these efforts, PTC uses data
monitoring and scouring technologies to obtain and transmit data on users of illegal copies of our software.
This data collection is not performed on users of legally licensed software from PTC and its authorized
distributors. If you are using an illegal copy of our software and do not consent to the collection and
transmission of such data (including to the United States), cease using the illegal version, and contact PTC to
obtain a legally licensed copy.
Important Copyright, Trademark, Patent, and Licensing Information: See the About Box, or copyright
notice, of your PTC software.
PTC software products and software documentation are “commercial items” as that term is defined at 48 C.F.
R. 2.101. Pursuant to Federal Acquisition Regulation (FAR) 12.212 (a)-(b) (Computer Software) (MAY 2014)
for civilian agencies or the Defense Federal Acquisition Regulation Supplement (DFARS) at 227.7202-1(a)
(Policy) and 227.7202-3 (a) (Rights in commercial computer software or commercial computer software
documentation) (FEB 2014) for the Department of Defense, PTC software products and software
documentation are provided to the U.S. Government under the PTC commercial license agreement. Use,
duplication or disclosure by the U.S. Government is subject solely to the terms and conditions set forth in the
applicable PTC software license agreement.
5
Menus, Commands, and Pop-up Menus .....................................................................97
Introduction ........................................................................................................98
Menu Bar Definitions...........................................................................................98
Menus Buttons and Menus ..................................................................................98
Designating Commands .................................................................................... 102
Pop-up Menus.................................................................................................. 104
Models ................................................................................................................... 109
Overview of Model Objects ................................................................................ 110
Getting a Model Object...................................................................................... 110
Model Descriptors............................................................................................. 110
Retrieving Models............................................................................................. 112
Model Information............................................................................................. 112
Model Operations ............................................................................................. 116
Running PTC Creo ModelCHECK ...................................................................... 117
Drawings ................................................................................................................ 121
Overview of Drawings in J-Link .......................................................................... 122
Creating Drawings from Templates..................................................................... 122
Obtaining Drawing Models ................................................................................ 124
Drawing Information.......................................................................................... 125
Drawing Operations .......................................................................................... 125
Drawing Sheets ................................................................................................ 127
Drawing Views ................................................................................................. 130
Drawing Dimensions ......................................................................................... 135
Drawing Tables................................................................................................. 142
Detail Items ...................................................................................................... 149
Detail Entities ................................................................................................... 151
OLE Objects..................................................................................................... 154
Detail Notes ..................................................................................................... 154
Detail Groups ................................................................................................... 158
Detail Symbols ................................................................................................. 160
Detail Attachments............................................................................................ 172
Solid....................................................................................................................... 175
Getting a Solid Object ....................................................................................... 176
Solid Information .............................................................................................. 176
Solid Operations ............................................................................................... 177
Solid Units........................................................................................................ 179
Mass Properties ............................................................................................... 185
Annotations...................................................................................................... 186
Cross Sections ................................................................................................. 187
Materials .......................................................................................................... 187
Windows and Views ................................................................................................ 195
Windows .......................................................................................................... 196
Embedded Browser .......................................................................................... 198
Views............................................................................................................... 199
Coordinate Systems and Transformations .......................................................... 200
Contents 7
J-Link Action Listeners ...................................................................................... 292
Creating an ActionListener Implementation......................................................... 292
Action Sources ................................................................................................. 293
Types of Action Listeners .................................................................................. 294
Cancelling an ActionListener Operation .............................................................. 299
Interface ................................................................................................................. 301
Exporting Files and 2D Models .......................................................................... 302
Exporting to PDF and U3D ................................................................................ 310
Exporting 3D Geometry..................................................................................... 317
Shrinkwrap Export ............................................................................................ 321
Importing Files.................................................................................................. 328
Importing 3D Geometry ..................................................................................... 330
Plotting Files .................................................................................................... 333
Printing Files .................................................................................................... 334
Solid Operations ............................................................................................... 342
Window Operations .......................................................................................... 343
Simplified Representations ...................................................................................... 345
Overview.......................................................................................................... 346
Retrieving Simplified Representations ................................................................ 347
Creating and Deleting Simplified Representations ............................................... 348
Extracting Information About Simplified Representations ..................................... 348
Modifying Simplified Representations................................................................. 349
Simplified Representation Utilities ...................................................................... 350
Asynchronous Mode................................................................................................ 353
Overview.......................................................................................................... 354
Simple Asynchronous Mode .............................................................................. 355
Starting and Stopping PTC Creo Parametric ....................................................... 356
Connecting to a PTC Creo Parametric Process ................................................... 357
Full Asynchronous Mode ................................................................................... 359
Troubleshooting Asynchronous J-Link ................................................................ 361
Task Based Application Libraries .............................................................................. 365
Managing Application Arguments....................................................................... 366
Launching a PTC Creo Parametric TOOLKIT DLL............................................... 367
Creating J-Link Task Libraries............................................................................ 370
Launching Tasks from J-Link Task Libraries ........................................................ 371
Graphics................................................................................................................. 373
Overview.......................................................................................................... 374
Getting Mouse Input.......................................................................................... 374
Displaying Graphics .......................................................................................... 375
External Data .......................................................................................................... 379
External Data ................................................................................................... 380
Exceptions ....................................................................................................... 383
PTC Windchill Connectivity APIs .............................................................................. 385
Introduction ...................................................................................................... 386
Contents 9
About This Guide
This section contains information about the contents of this user’s guide and the
conventions used.
Purpose
This manual describes how to use J-Link, a Java language toolkit for PTC Creo
Parametric. J-Link makes possible the development of Java programs that access
the internal components of a PTC Creo Parametric session, to customize PTC
Creo Parametric models.
Note
J-Link is supported only with PTC Creo Parametric. It is not supported with
the other PTC Creo applications.
Audience
This manual is intended for experienced PTC Creo Parametric users who are
already familiar with Java or another object-oriented language.
Prerequisites
This manual assumes you have the following knowledge:
• PTC Creo Parametric
• The syntax and language structure of Java.
11
Documentation
The documentation for J-Link includes the following:
• J-Link User’s Guide
• An online browser that describes the syntax of the J-Link methods and
provides a link to the online version of this manual. The online version of the
documentation is updated more frequently than the printed version. If there are
any discrepancies, the online version is the correct one.
Conventions
The following table lists conventions and terms used throughout this book.
Convention Description
UPPERCASE PTC Creo Parametric-type menu name (for example,
PART).
Boldface Windows-type menu name or menu or dialog box
option (for example, View), or utility. Boldface
font is also used for keywords, J-Link methods,
names of dialog box buttons, and PTC Creo
Parametric commands.
Monospace (Courier) Code samples appear in courier font like
this. Java aspects (methods, classes, data types,
object names, and so on) also appear in Courier font.
Emphasis Important information appears in italics like this.
Italic font is also used for file names and uniform
resource locators (URLs).
Choose Highlight a menu option by placing the arrow cursor
on the option and pressing the left mouse button.
Select A synonym for “choose” as above, Select also
describes the actions of selecting elements on a
model and checking boxes.
Element An element describes redefinable characteristics of a
feature in a model.
Mode An environment in PTC Creo Parametric in which
you can perform a group of closely related functions
(Drawing, for example).
Model An assembly, part, drawing, format, notebook, case
study, sketch, and so on.
Option An item in a menu or an entry in a configuration file
or a setup file.
Solid A part or an assembly.
<creo_loadpoint> The location where the PTC Creo applications are
installed, for example, C:\Program Files\
PTC\Creo 1.0.
<creo_jlink_loadpoint> The location where the J-Link application is
installed, that is, <creo_loadpoint>\
<datecode>\Common Files\jlink.
This chapter describes how to set up your environment so you can run J-Link.
15
Setting Up Your Machine
See Java Options and Debugging on page 421 for more information about
supported Java Virtual Machines and how to setup PTC Creo Parametric.
Standalone Applications
You can start the J-Link application independently at any time, regardless of
which models are in session. A registry file contains key information regarding
the execution of the program.
Using application programs you can make additions to the PTC Creo Parametric
user interface, gather or change data associated with the models in session, or add
session-level ActionListener routines. See the chapter Action Listeners on
page 291 for more information on ActionListeners.
Registry File
A registry file contains PTC Creo Parametric-specific information about the
standalone application you want to load.
The registry file called protk.dat is a simple text file, where each line consists
of one predefined keyword followed by a value. The standard form of the
protk.dat file is as follows:
name java_demo
startup java
java_app_class MyJavaApp
java_app_start start
java_app_stop stop
allow_stop true
delay_start true
Setting Up J-Link 17
used in the application. This field has a character limit of 2047 wide characters
(wchar_t).
• end—Indicates the end of the description of the J-Link application. You can
define multiple J-Link applications in the registry files. All these applications
are started by PTC Creo Parametric.
Note
From Creo Parametric 1.0 onward, the file name prodev.dat has been
replaced with creotk.dat or protk.dat. The configuration file
option prodevdat can now be either creotkdat, or protkdat, or
toolkit_registry_file.
Setting Up J-Link 19
• Associate and run a J-Link application with a model
• Create a JAR file for Model-Program Dependency
You can add JAR files to, or remove them from, a model by using the buttons on
the left side of the model program interface. All the JAR files for the model
program must be placed in the PTC Creo Parametric search path.
Note
When naming a J-Link model program JAR file, you must use lower case.
Setting Up J-Link 21
2
Java Programming Considerations
Use of the JDK in J-Link Applications ..........................................................................24
Java Overview ..........................................................................................................24
Java Keywords..........................................................................................................26
Java Data Types .......................................................................................................27
Event Handling..........................................................................................................27
Comments ................................................................................................................28
This chapter contains a brief overview of the Java programming language. None
of the information provided in this chapter is specific to J-Link.
23
Use of the JDK in J-Link Applications
Sun Microsystems provides a large number of objects and methods with the Java
Development Kit (JDK). These objects and methods include the following:
• Utilities and methods for a large volume of common programming tasks—
Java has APIs for manipulating data, creating vectors (expandable arrays),
responding to events, creating queues, and creating hash tables.
• Methods for file manipulation—The java.io API contains objects that
enable you to read and write data to and from files.
• Creation of Web-enabled applets—The java.applet API enables quick
creation of a Java applet for use in an HTML page.
• Access to user interface components—The java.awt and “Swing” APIs
allow creation of simple and complex user interfaces.
• Java Database Connectivity (JDBC)—JDBC provides interaction with
database objects
For information on specific classes and methods in the Java API’s, visit the Sun
Web site at the following URL:
http://java.sun.com/docs/index.html
Examples in this guide usually do not use classes from the Java API beyond the
ones found in the package java.lang. Most of the other packages can be used
to improve a J-Link program, but they are not absolutely necessary to create the
program.
Java Overview
Java is an object-oriented programming language that offers portability across
multiple platforms.
Note
The Java Overview presented here describes technical information known to
be true for Java version 1.1.5. Later Java versions may render some of this
information incorrect or obsolete.
class B extends A {
public B() {
//A is a superclass of B, B is a subclass of A.
}
}
// Constructor of B
class B implements A {
// Implementation of this method
public void doNothing() {
}
}
• Polymorphism—You can substitute a derived class whenever its base class
is required.
• Method overriding and overloading—You can redefine a superclass
method with an exact signature and return type. In addition, you can define
methods or constructors with different signatures.
• Platform-independent interpreter—Java is architecture-neutral.
When you compile a Java program, the compiler translates your program into
platform-independent instructions called Java bytecodes. You then use an
interpreter to parse each Java bytecode and run it on the computer. Your Java
program is compiled only once, but is interpreted each time you run it.
Java bytecodes are like machine code instructions for the Java Virtual
Machine (JVM).
• High performance—Java is a high-performance language that is dynamic
—you can load Java classes into a running Java interpreter.
• No pointers—Java does not allow you to use pointers to directly reference
memory locations. However, all object references are, in effect, pointers,
because they refer to a location in memory that contains an object. Therefore,
setting one object equal to another does not create a new version of the object.
For example:
String mystring = yourstring;
Java Keywords
This section describes the Java keywords most commonly used when using J-
Link.
The following keywords specify the accessibility to data:
• public—Accessible from the class, subclass, package, and world.
• private—Accessible only from the class.
• protected—Accessible from the class, subclass, and package.
• package—Accessible from the class and package. This is the default access.
The following keywords describe variables or methods:
• static—The method or variable is not attached to a particular object, but to
an entire class.
The advantage of a static method is that you do not need to define an instance
of the class in order to use the method.
• final—Specifies that the class, method, or field will not be modified by
another object.
A static final declaration identifies a constant.
• new—Creates instances of various classes. The following statement shows an
example of instantiation:
String mystring = new String ("This is my string.");
Except for single objects, you cannot use the new keyword to initialize J-Link
objects. You can use new to construct objects that do not explicitly belong to
J-Link (that is, Java API objects).
• instanceof—The Java instanceof operator is a way to determine
whether a particular object can be correctly cast to a specified class. The
instanceof operator produces a Boolean value that identifies whether the
object is a member of that class. The typical use is as follows:
if (<objectname> instanceof <classname>)
Note
Java represents character strings only as objects, not as arrays of characters.
There is no corresponding primitive string type.
Event Handling
Java implements listeners and adapters to notify you of certain events. There are
three kinds of listeners:
Comments
Java provides three different types of comment characters: C++-style, C-style, and
javadoc-style.
As in the C++ language, two double slashes (//) are used to specify a one-line
comment. For example:
.
.
.
// This method retrieves the value of the dimension.
.
.
.
31
Class Types
J-Link is made up of a number classes in many packages. The following are the
eight main classes.
• Creo Parametric-Related Interfaces—Contain unique methods
and attributes that are directly related to the functions in PTC Creo Parametric.
See the section PTC Creo Parametric-Related Interfaces on page 32 for
additional information.
• Compact Data Classes—Classes containing data needed as arguments to
some J-Link methods. See the section Compact Data Classes on page 34 for
additional information.
• Union Classes—A class with a potential for multiple types of values. See
the section Unions on page 35 for additional information.
• Sequence Classes—Expandable arrays of objects or primitive data types.
See the section Sequences on page 35 for more information.
• Array Classes—Arrays that are limited to a certain size. See the section
Arrays on page 37 for more information.
• Enumeration Classes—Defines enumerated types. See the section
Enumeration Classes on page 38 for more information.
• ActionListener Classes—Enables you to specify programs that will
run only if certain events in PTC Creo Parametric take place. See the section
Action Listeners on page 40 for more information.
• Utility Classes—Contains static methods used to initialize certain J-
Link objects. See the section Utilities on page 42 for more information.
Each class shares specific rules regarding initialization, attributes, methods,
inheritance, or exceptions. The following seven sections describe these classes in
detail.
Initialization
You cannot construct one of these objects using the Java keyword new. Some
objects that represent PTC Creo Parametric objects cannot be created directly but
are returned by a Get or Create method.
Attributes
Attributes within PTC Creo Parametric-related objects are not directly accessible,
but can be accessed through Get and Set methods. These methods are of the
following types:
Attribute name: int XYZ
Methods: int GetXYZ();
void SetXYZ (int i);
Some attributes that have been designated as read can only be accessed by the
Get method.
Methods
You must start Methods from the object in question and you must first initialize
that object. For example, the following calls are illegal:
Window window;
Inheritance
All PTC Creo Parametric related objects are defined as interfaces so that they can
inherit methods from other interfaces. To use these methods, call them directly (no
casting is needed). For example:
public interface Feature
extends jxobject,
pfcModelItem.ParameterOwner,
pfcObject.Parent,
pfcObject.Object,
pfcModelItem.ModelItem
Overview of J-Link 33
// class ModelItem.
However, if you have a reverse situation, you need to explicitly cast the object.
For example:
ModelItem item; // You know this is a Feature -- perhaps
// you previously checked its type.
int number = ((Feature)item).GetNumber();
// GetNumber() is a Feature method.
Exceptions
Almost every J-Link method can throw an exception of type
com.ptc.cipjava.jxthrowable. Surround each method you use with a
try-catch-finally block to handle any exceptions that are generated. See
the Exceptions section for more information.
Initialization
You can create instances of these classes using a static create method.
Example: pfcModel.BOMExportIntructions_Create()
This static method usually belongs to the utility class in the specific package that
the compact data class belong to.
Attributes
Attributes within compact data related classes are not directly accessible, but can
be accessed through Get and Set methods. These methods are of the following
types:
Attribute name: int XYZ
Methods: int GetXYZ();
void SetXYZ (int i);
Methods
You must start Methods from the object in question and you must first initialize
that object. For example, the following calls are illegal:
SelectionOptions options;
Exceptions
Almost every J-Link method can throw an exception of type
com.ptc.cipjava.jxthrowable. Surround each method you use with a
try-catch-finally block to handle any exceptions that are generated.
Unions
Unions are interface-like objects. Every union has a discriminator method with the
pre-defined name Getdiscr(). This method returns a value identifying the type
of data that the union objects holds. For each union member, a pair of (Get/Set)
methods is used to access the different data types. It is illegal to call any Get
method except the one that matches the value returned from Getdiscr().
However, any Set method can be called. This switches the discriminator to the
new value.
The following is an example of a J-Link union:
class ParamValue
{
public:
ParamValueType Getdiscr ();
String GetStringValue ();
void SetStringValue (String value);
int GetIntValue ();
void SetIntValue (int value);
boolean GetBoolValue ();
void SetBoolValue (boolean value);
double GetDoubleValue ();
void SetDoubleValue (double value);
int GetNoteId ();
void SetNoteId (int value);
};
Sequences
Sequences are expandable arrays of primitive data types or objects in J-Link. All
sequence classes have the same methods for adding to and accessing the array.
Sequence classes are identified by a plural name, or the suffix seq.
Overview of J-Link 35
Initialization
You cannot construct one of these objects using the Java keyword new. Static
create methods for each list type are available. For example,
pfcModel.Models.create() returns an empty Models sequence object
for you to fill in.
Attributes
The attributes within sequence objects must be accessed using methods.
Methods
Sequence objects always contain the same methods: get, set,
getarraysize, insert, insertseq, removerange, and create.
Methods must be invoked from an initialized object of the correct type, except for
the static create method, which is invoked from the sequence class.
Inheritance
Sequence classes do not inherit from any other J-Link classes. Therefore, you
cannot cast sequence objects to any other type of J-Link object, including other
sequences. For example, if you have a list of model items that happen to be
features, you cannot make the following call:
Features features = (Features) modelitems;
To construct this array of features, you must insert each member of the list
separately while casting it to a Feature.
Exceptions
If you try to get or remove an object beyond the last object in the sequence, the
exception cipjava.XNoAttribute is thrown.
Arrays
Arrays are groups of primitive types or objects of a specified size. An array can be
one or two dimensional. The following array classes are in the pfcBase
package: Matrix3D, Point2D, Point3D, Outline2D, Outline3D,
UVVector, UVParams, Vector2D, and Vector3D. See the online reference
documentation to determine the exact size of these arrays.
Initialization
You cannot construct one of these objects using the Java keyword new. Static
creation methods are available for each array type. For example, the method
pfcBase.Point2D.create returns an empty Point2D array object for you
to fill in.
Attributes
The attributes within array objects must be accessed using methods.
Methods
Array objects always contain the same methods: get, set, and create.
Methods must be invoked from an initialized object of the correct type, except for
the create method, which is invoked from the name of the array class.
Overview of J-Link 37
Inheritance
Array classes do not inherit from any other J-Link classes.
Exceptions
If you try to access an object that is not within the size of the array, the exception
cipjava.XNoAttribute is thrown.
Enumeration Classes
In J-Link, enumeration classes are used in the same way that an enum is used in C
or C++. An enumeration class defines a limited number of static final instances
which correspond to the members of the enumeration. Each static final instance
has a corresponding static final integer constant. In the FeatureType
enumeration class the static instance FEATTYPE_HOLE has as it’s integer
equivalent _FEATTYPE_HOLE . Enumeration classes in J-Link generally have
names of the form XYZType or XYZStatus.
Enumeration instances are passes whenever a method requires you to choose
among multiple options. Use the integer constants where an int is required (such
as cases in a switch statement).
Initialization
You cannot construct one of these objects. You simply use the name of the static
instance or static integer constant.
Methods
Enumeration classes have one method that you are likely to use:
• getValue—Returns the integer value of an enumeration instance.
Inheritance
Enumeration classes do not inherit from any other J-Link classes.
Exceptions
Enumeration classes do not throw exceptions.
Overview of J-Link 39
public static final int _PLACE_OUTSIDE = 2;
Action Listeners
Use ActionListeners in J-Link to assign programmed reactions to events
that occur within PTC Creo Parametric. J-Link defines a set of action listener
interfaces that can be implement enabling PTC Creo Parametric to call your J-
Link application when specific events occur. These interfaces are designed to
respond to events from action sources in PTC Creo Parametric. Examples of
action sources include the session, user-interface commands, models, solids,
parameters, and features.
Initialization
For each of its defined ActionListener interfaces, J-Link provides a
corresponding default implementation class. For example, the
SolidActionListener interface has a corresponding
DefaultSolidActionListener implementation. All of the default action
listener classes override every listener method with an empty method.
You must use the default implementation to construct applications. You cannot
directly implement the SolidActionListener interface, as this interface will
be missing the routing used internally by J-Link.
You implement an action listener class by inheriting the appropriate default class
and overriding the methods that respond to specific events. For the other events,
PTC Creo Parametric calls the empty methods inherited from the default class.
Construct your ActionListener classes using the Java keyword new. Then
assign your ActionListener to an ActionSource using the
AddActionListener() method of the action source.
Attributes
Action listeners do not have any accessible attributes.
Inheritance
All J-Link ActionListener objects inherit from the interface
pfcBase.ActionListener.
Exceptions
Action listeners cause methods to be called outside of your application start and
stop methods. Therefore, you must include exception-handling code inside the
ActionListener implementation if you want to respond to exceptions. In
some methods called before an event, propagating an exception out of your
method will cancel the impending event.
{
void OnBeforeRegen
(
com.ptc.pfc.pfcSolid.Solid Sld,
com.ptc.pfc.pfcFeature.Feature /* optional */ StartFeature
) throws jxthrowable;
void OnAfterRegen (
com.ptc.pfc.pfcSolid.Solid Sld,
com.ptc.pfc.pfcFeature.Feature /* optional */ StartFeature,
boolean WasSuccessful
) throws jxthrowable;
void OnBeforeUnitConvert (
com.ptc.pfc.pfcSolid.Solid Sld,
boolean ConvertNumbers
) throws jxthrowable;
void OnAfterUnitConvert (
com.ptc.pfc.pfcSolid.Solid Sld,
Overview of J-Link 41
boolean ConvertNumbers
) throws jxthrowable;
};
Utilities
Each package in J-Link has one class that contains special static methods used to
create and access some of the other classes in the package. These utility classes
have the same name as the package, such as pfcModel.pfcModel.
Initialization
Because the utility packages have only static methods, you do not need to
initialize them. Simply access the methods through the name of the class, as
follows:
ParamValue pv = pfcModelItem.CreateStringParamValue ("my_param");
Attributes
Utilities do not have any accessible attributes.
Methods
Utilities contain only static methods used for initializing certain J-Link objects.
Inheritance
Utilities do not inherit from any other J-Link classes.
Exceptions
Methods in utilities can throw jxthrowable type exceptions.
Creating Applications
The following sections describe how to create applications. The topics are as
follows:
• Importing Packages on page 43
• Application Hierarchy on page 43
• Exception Handling on page 44
Importing Packages
To use pfc code in your application you must import the necessary packages.
Import each class or package with a statement similar to the following:
For the Parameter class only:
import com.ptc.pfc.pfcModelItem.Parameter;
For the package pfcBase (all classes):
import com.ptc.pfc.pfcBase.*;
You might also need to import the methods in com.ptc.cipjava, which
contains the underlying J-Link structure, including exceptions and certain
sequences.. Use the following statement:
import com.ptc.cipjava.*;
Application Hierarchy
The rules of object orientation require a certain hierarchy of object creation when
you start a J-Link application. The method invoked must be
pfcGlobal.GetProESession, which returns a handle to the current session
of PTC Creo Parametric.
The application must iterate down to the level of object you want to access. For
example, to list all the datum axes contained in the hole features in all models in
session, do the following:
1. Get a handle to the session:
2. Get the models that are active in the session:
3. Get the feature model items in each model:
Overview of J-Link 43
4. Filter out the features of type hole:
5. Get the subitems in each feature that are axes:
Exception Handling
Nearly all J-Link methods are declared as throwing the jxthrowable
exception, as shown here in the declaration of Model.CreateLayer().
com.ptc.pfc.pfcLayer.Layer CreateLayer (
String Name
) throws jxthrowable;
In fact, the jxthrowable exception is never actually thrown. It is the parent
class of all the exceptions that are thrown by J-Link methods and satisfies Java’s
requirement that a method’s declaration include the exceptions that it throws.
The following figure organizes the J-Link exceptions into three categories to
facilitate the discussion that follows.
Overview of J-Link 45
cipjava Exceptions
The cipjava exceptions are thrown by classes in the com.ptc.cipjava
package. With the exception of the intseq, realseq, boolseq, and
stringseq classes, these classes are only used internally.
The following table describes these exceptions.
Exception Purpose
XInvalidArrayDimIndex, Illegal index value used when accessing a cipjava
XInvalidArrayIndex, array, sequence, or dictionary. (The J-Link interface
XInvalidDictIndex, XNegativeIndex does not currently include any dictionary classes.)
XLicense Licensing error (license does not exist, lost, server
down, etc.)
XMsgStringTooLong Communication synchronization problem between
PTC Creo Parametric and J-Link application. Restart
the J-Link application.
XNativeException Unknown exception occurred in another language.
This usually signals a serious error (such as division
by zero or class not found) that is related to the J-
Link application.
XCannotConnect, XConnectionClosed, Communication problems between PTC Creo
XFlushFailed Parametric and the J-Link application.
Other, internal errors Internal assertions that should not append and which
need not be caught individually.
PFC Exceptions
The PFC exceptions are thrown by the classes that make up J-Link’s public
interface. The following table describes these exceptions.
Exception Purpose
XBadExternalData An attempt to read contents of an external data object
which has been terminated.
XBadGetArgValue Indicates attempt to read the wrong type of data from
the ArgValue union.
XBadGetExternalData Indicates attempt to read the wrong type of data from
the ExternalData union.
XBadGetParamValue Indicates attempt to read the wrong type of data from
the ParamValue union.
XBadOutlineExcludeType Indicates an invalid type of item was passed to the
outline calculation method.
XCancelProEAction This exception type will not be thrown by J-Link
methods, but you may instantiate and throw this from
certain ActionListener methods to cancel the
corresponding action in PTC Creo Parametric.
XCannotAccess The contents of a J-Link object cannot be accessed in
this situation.
XEmptyString An empty string was passed to a method that does
not accept this type of input.
XInvalidEnumValue Indicates an invalid value for a specified
enumeration class.
Overview of J-Link 47
XToolkitError Child Class PTC Creo Parametric #
TOOLKIT Error
XToolkitGeneralError PRO_TK_GENERAL_ERROR -1
XToolkitBadInputs PRO_TK_BAD_INPUTS -2
XToolkitUserAbort PRO_TK_USER_ABORT -3
XToolkitNotFound PRO_TK_E_NOT_FOUND -4
XToolkitFound PRO_TK_E_FOUND -5
XToolkitLineTooLong PRO_TK_LINE_TOO_LONG -6
XToolkitContinue PRO_TK_CONTINUE -7
XToolkitBadContext PRO_TK_BAD_CONTEXT -8
XToolkitNotImplemented PRO_TK_NOT_IMPLEMENTED -9
XToolkitOutOfMemory PRO_TK_OUT_OF_MEMORY -10
XToolkitCommError PRO_TK_COMM_ERROR -11
XToolkitNoChange PRO_TK_NO_CHANGE -12
XToolkitSuppressedPar PRO_TK_SUPP_PARENTS -13
ents
XToolkitPickAbove PRO_TK_PICK_ABOVE -14
XToolkitInvalidDir PRO_TK_INVALID_DIR -15
XToolkitInvalidFile PRO_TK_INVALID_FILE -16
XToolkitCantWrite PRO_TK_CANT_WRITE -17
XToolkitInvalidType PRO_TK_INVALID_TYPE -18
XToolkitInvalidPtr PRO_TK_INVALID_PTR -19
XToolkitUnavailableSec PRO_TK_UNAV_SEC -20
tion
XToolkitInvalidMatrix PRO_TK_INVALID_MATRIX -21
XToolkitInvalidName PRO_TK_INVALID_NAME -22
XToolkitNotExist PRO_TK_NOT_EXIST -23
XToolkitCantOpen PRO_TK_CANT_OPEN -24
XToolkitAbort PRO_TK_ABORT -25
XToolkitNotValid PRO_TK_NOT_VALID -26
XToolkitInvalidItem PRO_TK_INVALID_ITEM -27
XToolkitMsgNotFound PRO_TK_MSG_NOT_FOUND -28
XToolkitMsgNoTrans PRO_TK_MSG_NO_TRANS -29
XToolkitMsgFmtError PRO_TK_MSG_FMT_ERROR -30
XToolkitMsgUserQuit PRO_TK_MSG_USER_QUIT -31
XToolkitMsgTooLong PRO_TK_MSG_TOO_LONG -32
XToolkitCantAccess PRO_TK_CANT_ACCESS -33
XToolkitObsoleteFunc PRO_TK_OBSOLETE_FUNC -34
XToolkitNoCoordSystem PRO_TK_NO_COORD_SYSTEM -35
XToolkitAmbiguous PRO_TK_E_AMBIGUOUS -36
XToolkitDeadLock PRO_TK_E_DEADLOCK -37
XToolkitBusy PRO_TK_E_BUSY -38
XToolkitInUse PRO_TK_E_IN_USE -39
XToolkitNoLicense PRO_TK_NO_LICENSE -40
XToolkitBsplUnsuitable PRO_TK_BSPL_UNSUITABLE_ -41
Degree DEGREE
Overview of J-Link 49
Approaches to J-Link Exception Handling
To deal with the exceptions generated by J-Link methods surround each method
with a try-catch-finally block. For example:
try {
JLinkObject.DoSomething()
}
catch (jxthrowable x) {
// Respond to the exception.
}
Rather than catching the generic exception, you can set up your code to respond to
specific exception types, using multiple catch blocks to respond to different
situations, as follows:
try
{
Object.DoSomething()
}
catch (XToolkitError x)
{
// Respond based on the error code.
x.GetErrorCode();
}
catch (XStringTooLong x)
{
// Respond to the exception.
}
catch (jxthrowable x) // Do not forget to check for
// an unexpected error!
{
// Respond to the exception.
}
If you do not want to surround every block of code with a try statement, you can
declare your methods to throw the jxthrowable object. For example:
public class MyClass {
51
J-Link Thread Restrictions
When you run a synchronous J-Link program, you should configure your program
so it does not interfere with the main thread of the PTC Creo Parametric program.
Because the Java API allows you to run with multiple threads, you should be
cautious of using certain Java routines in your program.
The most obvious restriction involves the use of Java language user interfaces.
Any Java window that you create must be a dialog box that is blocking (or modal).
Creating a nonblocking frame causes a new thread to begin, which can have
unexpected results when running with PTC Creo Parametric. For example, you
can use the javax.swing.JDialog class and set modal true. You cannot use
javax.swing.JWindow, however, because it starts a thread.
{
com.ptc.pfc.pfcModelItem.ModelItems ListItems
(
com.ptc.pfc.pfcModelItem.ModelItemType
/* optional */ Type
) throws jxthrowable;
}
You can pass the Java keyword null in place of any such optional argument. In
addition, a return value of null is possible for returns that are declared optional.
The J-Link methods that take optional arguments provide default handling for null
parameters as is described in the online documentation.
Note
• If a J-Link method takes an optional primitive type, such as an int or
boolean, the argument will actually be a Java wrapper class, so that it may
be set to null.
• You can only pass null in place of arguments that are shown in the
documentation to be optional.
This chapter describes how to use the online browser provided with J-Link.
55
Online Documentation J-Link APIWizard
J-Link provides an online browser called the J-Link APIWizard that displays
detailed documentation. This browser displays information from the J-Link User’s
Guide and API specifications derived from J-Link header file data.
The J-Link APIWizard contains the following items:
• Definitions of J-Link packages and their hierarchical relationships
• Definitions of J-Link classes and interfaces
• Descriptions of J-Link methods
• Declarations of data types used by J-Link methods
• The J-Link User’s Guide, which you can browse by topic or by class
• Code examples for J-Link methods (taken from the sample applications
provided as part of the J-Link installation)
Read the Release Notes and README file for the most up-to-date information on
documentation changes.
Note
The J-Link User’s Guide is also available in PDF format. This file is located
at:
<creo_jlink_loadpoint>\jlinkug.pdf
Note
If Java 7 Update 21 or higher is installed on your computer, then the locally
installed applet based APIWizard will not open due to security issues. Use the
non-applet based APIWizard in such cases.
Troubleshooting
When you open the applet based APIWizard in Internet Explorer and if, the
browser detects the presence of the Java2 plug-in, though it is not be installed on
the computer, the browser the browser opens index.html and waits for the Java
applet to run. Since the Java2 plug-in is not installed, the Java applet is not
available, and the browser remains indefinitely in this state.
The workaround for this is to enable Java console in the Internet Explorer options:
1. Launch the Internet Explorer browser.
2. Click Tools>Internet Options. The Internet Options dialog box opens.
3. Click the Advanced tab.
4. Under Microsoft VM, check Java console enabled.
5. Click OK.
6. Click File>Close.
7. Restart the Internet Explorer browser.
You can also hover the mouse over after you enter a string in the search field.
The following search options are displayed:
• Class/Methods—Searches for classes and methods.
• Global Methods—Searches only for global methods.
• Exceptions—Searches only for exceptions.
Select an option and the search results are displayed based on this criteria.
Note
The APIWizard Search feature is slow when accessed through Internet
Explorer’s Default Virtual Machine. For better performance, access the
APIWizard through Internet Explorer’s Java2 plug-in.
Enter the specific search string or strings in this field. By default, the browser
performs a non-case-sensitive search.
• Search/Stop
Select the Search button to begin a search. During a search, this button name
changes to Stop. Select the Stop button to stop a search.
• Help
Select this button for help about the APIWizard search feature. The
APIWizard presents this help data in the Display frame.
• Case Sensitive
Select this button to search for data on API methods. Select the API Names
button to search for method names only. Select the Definitions button to search
the API method names and definitions for specific strings.
• Search Manuals
Select this button to search the J-Link User’s Guide data. Select the Table of
Contents button to search on TOC entries only. Select the Index button to
search only the Index. Select the Contents button to search on all text in the J-
Link User’s Guide.
• Name
This frame displays the location in the online help data where the APIWizard
found the string.
To search for any string containing the characters Get, one other character, and
the characters Name
Get?Name
To search for any string containing the characters Get, one or more other
characters, and the characters Name
Get?*Name
Note
This search specification also returns strings that match both specified
search targets.
For example:
FullName
returns all instances of strings continaing Get and Name, or strings containing
family table.
This chapter describes how to program on the session level using J-Link .
65
Overview of Session Objects
The PTC Creo Parametric Session object (contained in the class
com.ptc.pfc.pfcSession.Session) is the highest level object in J-Link.
Any program that accesses data from PTC Creo Parametric must first get a handle
to the Session object before accessing more specific data.
The Session object contains methods to perform the following operations:
• Accessing models and windows (described in the Models and Windows
chapters).
• Working with the PTC Creo Parametric user interface.
• Allowing interactive selection of items within the session.
• Accessing global settings such as line styles, colors, and configuration options.
The following sections describe these operations in detail.
Directories
Methods Introduced:
• pfcSession.BaseSession.GetCurrentDirectory
• pfcSession.BaseSession.ChangeDirectory
The method pfcSession.BaseSession.GetCurrentDirectory
returns the absolute path name for the current working directory of PTC Creo
Parametric.
The method pfcSession.BaseSession.ChangeDirectory changes
PTC Creo Parametric to another working directory.
File Handling
Methods Introduced:
• pfcSession.BaseSession.ListFiles
• pfcSession.BaseSession.ListSubdirectories
The method pfcSession.BaseSession.ListFiles returns a list of files
in a directory, given the directory path. You can filter the list to include only files
of a particular type, as specified by the file extension.
Starting with Pro/ENGINEER Wildfire 5.0 M040, the method
pfcSession.BaseSession.ListFiles can also list instance objects
when accessing PTC Windchill workspaces or folders. A PDM location (for
workspace or commonspace) must be passed as the directory path. The following
options have been added in the FileListOpt enumerated type:
Configuration Options
Methods Introduced:
• pfcSession.BaseSession.GetConfigOptionValues
• pfcSession.BaseSession.SetConfigOption
• pfcSession.BaseSession.LoadConfigFile
You can access configuration options programmatically using the methods
described in this section.
Use the method pfcSession.BaseSession.GetConfigOptionValues
to retrieve the value of a specified configuration file option. Pass the Name of the
configuration file option as the input to this method. The method returns an array
of values that the configuration file option is set to. It returns a single value if the
configuration file option is not a multi-valued option. The method returns a null if
the specified configuration file option does not exist.
The method pfcSession.BaseSession.SetConfigOption is used to
set the value of a specified configuration file option. If the option is a multi-value
option, it adds a new value to the array of values that already exist.
The method pfcSession.BaseSession.LoadConfigFile loads an
entire configuration file into PTC Creo Parametric.
Macros
Method Introduced:
• pfcSession.BaseSession.RunMacro
The method pfcSession.BaseSession.RunMacro runs a macro string. A
J-Link macro string is equivalent to a PTC Creo Parametric mapkey minus the key
sequence and the mapkey name. To generate a macro string, create a mapkey in
PTC Creo Parametric. Refer to the PTC Creo Parametric online help for more
information about creating a mapkey.
Session Objects 67
Copy the Value of the generated mapkey Option from the Tools ▶ Options dialog
box. An example Value is as follows:
$F2 @MAPKEY_LABELtest;
~ Activate `main_dlg_cur` `ProCmdModelNew.file`;
~ Activate `new` `OK`;
The key sequence is $F2. The mapkey name is @MAPKEY_LABELtest. The
remainder of the string following the first semicolon is the macro string that
should be passed to the method pfcSession.BaseSession.RunMacro.
In this case, it is as follows:
~ Activate `main_dlg_cur` `ProCmdModelNew.file`;
~ Activate `new` `OK`;
Note
Creating or editing the macro string manually is not supported as the mapkeys
are not a supported scripting language. The syntax is not defined for users and
is not guaranteed to remain constant across different datecodes of PTC Creo
Parametric.
Macros are executed from synchronous mode only when control returns to PTC
Creo Parametric from the J-Link program. Macros in synchronous mode are
stored in reverse order (last in, first out).
Note
Message files are loaded into PTC Creo Parametric only once during a
session. If you make a change to the message file while PTC Creo Parametric
is running you must exit and restart PTC Creo Parametric before the change
will take effect.
Session Objects 69
Contents of the Message File
The message file consists of groups of four lines, one group for each message you
want to write. The four lines are as follows:
1. A string that acts as the identifier for the message. This keyword must be
unique for all PTC Creo Parametric messages.
2. The string that will be substituted for the identifier.
This string can include placeholders for run-time information stored in a
stringseq object (shown in Writing Messages to the Message Window).
3. The translation of the message into another language (can be blank).
4. An intentionally blank line reserved for future extensions.
Session Objects 71
These methods take the same input arguments and perform exactly the same
argument substitution and translation as the
pfcSession.Session.UIDisplayMessage and
pfcSession.Session.UIDisplayLocalizedMessage methods
described in the previous section.
Message Classification
Messages displayed in J-Link include a symbol that identifies the message type.
Every message type is identified by a classification that begins with the characters
%C. A message classification requires that the message key line (line one in the
message file) must be preceded by the classification code.
Note
Any message key string used in the code should not contain the classification.
J-Link applications can now display any or all of the following message symbols:
• Prompt—This J-Link message is preceded by a green arrow. The user must
respond to this message type. Responding includes, specifying input
information, accepting the default value offered, or canceling the application.
If no action is taken, the progress of the application is halted. A response may
either be textual or a selection. The classification for Prompt messages is %CP
• Info—This J-Link message is preceded by a blue dot. Info message types
contain information such as user requests or feedback from J-Link or PTC
Creo Parametric. The classification for Info messages is %CI
Note
Do not classify messages that display information regarding problems with
an operation or process as Info. These types of messages must be
classified as Warnings.
Session Objects 73
File Dialogs
Methods Introduced:
• pfcSession.Session.UIOpenFile
• pfcUI.pfcUI.FileOpenOptions_Create
• pfcUI.FileOpenOptions.SetFilterString
• pfcUI.FileOpenOptions.SetPreselectedItem
• pfcUI.FileUIOptions.SetDefaultPath
• pfcUI.FileUIOptions.SetDialogLabel
• pfcUI.FileUIOptions.SetShortcuts
• pfcUI.pfcUI.FileOpenShortcut_Create
• pfcUI.FileOpenShortcut.SetShortcutName
• pfcUI.FileOpenShortcut.SetShortcutPath
• pfcSession.Session.UISaveFile
• pfcUI.pfcUI.FileSaveOptions_Create
• pfcSession.Session.UISelectDirectory
• pfcUI.pfcUI.DirectorySelectionOptions_Create
The method pfcSession.Session.UIOpenFile opens the relevant dialog
box for browsing directories and opening files. The method lets you specify
several options through the input arguments pfcUI.FileOpenOptions and
pfcUI.FileUIOptions.
Use the method pfcUI.pfcUI.FileOpenOptions_Create to create a
new instance of the pfcUI.FileOpenOptions object. This object contains
the following options:
• FilterString—Specifies the filter string for the type of file accepted by
the dialog box. Multiple file types should be listed with wildcards and
separated by commas, for example, *.prt, *.asm, *.txt, *.avi, and so
on. Use the method pfcUI.FileOpenOptions.SetFilterString to
set this option.
• PreselectedItem—Specifies the name of an item to preselect in the
dialog box. Use the method
pfcUI.FileOpenOptions.SetPreselectedItem to set this option.
The pfcUI.FileUIOptions object contains the following options:
Session Objects 75
Customizing the PTC Creo Parametric Navigation
Area
The PTC Creo Parametric navigation area includes the Model and Layer Tree
pane, Folder browser pane, and Favorites pane. The methods described in this
section enable J-Link applications to add custom panes that contain Web pages to
the PTC Creo Parametric navigation area.
Session Objects 77
7
Selection
Interactive Selection ..................................................................................................80
Accessing Selection Data ..........................................................................................81
Programmatic Selection.............................................................................................83
Selection Buffer.........................................................................................................84
79
Interactive Selection
Methods Introduced:
• pfcSession.BaseSession.Select
• pfcSelect.pfcSelect.SelectionOptions_Create
• pfcSelect.SelectionOptions.SetMaxNumSels
• pfcSelect.SelectionOptions.SetOptionKeywords
The method pfcSession.BaseSession.Select activates the standard
PTC Creo Parametric menu structure for selecting objects and returns a
pfcSelect.Selections sequence that contains the objects the user selected.
Using the Options argument, you can control the type of object that can be
selected and the maximum number of selections.
In addition, you can pass in a pfcSelect.Selections sequence to the
method. The returned pfcSelect.Selections sequence will contain the
input sequence and any new objects.
The methods pfcSelect.pfcSelect.SelectionOptions_Create
pfcSelect.SelectionOptions.SetOptionKeywords take a String
argument made up of one or more of the identifiers listed in the table below,
separated by commas.
For example, to allow the selection of features and axes, the arguments would be
feature, axis.
PTC Creo Parametric String Identifier ModelItemType
Database Item
Datum point point ITEM_POINT
Datum axis axis ITEM_AXIS
Datum plane datum ITEM_SURFACE
Coordinate system datum csys ITEM_COORD_SYS
Feature feature ITEM_FEATURE
Edge (solid or datum surface) edge ITEM_EDGE
Edge (solid only) sldedge ITEM_EDGE
Edge (datum surface only) qltedge ITEM_EDGE
Datum curve curve ITEM_CURVE
Composite curve comp_crv ITEM_CURVE
Surface (solid or quilt) surface ITEM_SURFACE
Surface (solid) sldface ITEM_SURFACE
Surface (datum surface) qltface ITEM_SURFACE
Quilt dtmqlt ITEM_QUILT
Dimension dimension ITEM_DIMENSION
Reference dimension ref_dim ITEM_REF_DIMENSION
Integer parameter ipar ITEM_DIMENSION
Part part N/A
Part or subassembly prt_or_asm N/A
Selection 81
• For the T parameter of the selection point on an edge or curve use
pfcSelect.Selection.GetTParam.
• For a three-dimensional point object that contains the selected point use
pfcSelect.Selection.GetPoint.
• For selection depth, in screen coordinates use
pfcSelect.Selection.GetDepth.
• For the selected drawing view, if the selection was from a drawing, use
pfcSelect.Selection.GetSelView2D.
• For the selected table cell, if the selection was from a table, use
pfcSelect.Selection.GetSelTableCell.
• For the selected table segment, if the selection was from a table, use
pfcSelect.Selection.GetSelTableSegment.
Note
This is a one-time action and the next repaint will erase this display.
Programmatic Selection
J-Link provides methods whereby you can make your own Selection objects,
without prompting the user. These Selections are required as inputs to some
methods and can also be used to highlight certain objects on the screen.
Methods Introduced:
• pfcSelect.pfcSelect.CreateModelItemSelection
• pfcSelect.pfcSelect.CreateComponentSelection
• pfcSelect.pfcSelect.CreateSelectionFromString
• pfcSelect.Selection.SetSelItem
• pfcSelect.Selection.SetPath
• pfcSelect.Selection.SetParams
• pfcSelect.Selection.SetTParam
• pfcSelect.Selection.SetPoint
• pfcSelect.Selection.SetSelTableCell
• pfcSelect.Selection.SetSelView2D
The method pfcSelect.pfcSelect.CreateModelItemSelection
creates a selection out of any model item object. It takes a
pfcModelItem.ModelItem and optionally a
pfcAssembly.ComponentPath object to identify which component in an
assembly the Selection Object belongs to.
The method pfcSelect.pfcSelect.CreateComponentSelection
creates a selection out of any component in an assembly. It takes a
pfcAssembly.ComponentPath object. For more information about
pfcAssembly.ComponentPath objects, see the section Getting a Solid
Object on page 176 in theSolid on page 175chapter.
The method pfcSelect.pfcSelect.CreateSelectionFromString
creates a new selection object, based on a Web.Link style selection string
specified as the input.
Some J-Link methods require more information to be set in the selection object.
The methods allow you to set the following:
The selected item using the method pfcSelect.Selection.SetSelItem.
Selection 83
The selected component path using the method
pfcSelect.Selection.SetPath.
The selected UV parameters using the method
pfcSelect.Selection.SetParams.
The selected T parameter (for a curve or edge), using the method
pfcSelect.Selection.SetTParam.
The selected XYZ point using the method
pfcSelect.Selection.SetPoint.
The selected table cell using the method
pfcSelect.Selection.SetSelTableCell.
The selected drawing view using the method
pfcSelect.Selection.SetSelView2D.
Selection Buffer
Introduction to Selection Buffers
Selection is the process of choosing items on which you want to perform an
operation. In PTC Creo Parametric, before a feature tool is invoked, the user can
select items to be used in a given tool's collectors. Collectors are like storage bins
of the references of selected items. The location where preselected items are
stored is called the selection buffer.
Depending on the situation, different selection buffers may be active at any one
time. In Part and Assembly mode, PTC Creo Parametric offers the default
selection buffer, the Edit selection buffer, and other more specialized buffers.
Other PTC Creo Parametric modes offer different selection buffers.
In the default Part and Assembly buffer there are two levels at which selection is
done:
• First Level Selection
Provides access to higher-level objects such as features or components. You
can make a second level selection only after you select the higher-level object.
• Second Level Selection
Provides access to geometric objects such as edges and faces.
Note
First-level and second-level objects are usually incompatible in the selection
buffer.
Selection 85
Note
The selected item must refer to an item that is in the current model such as its
owner, component path or drawing view.
This chapter describes the J-Link support for the Ribbon User Interface (UI). It
also describes the impact of the ribbon user interface on legacy J-Link
applications and the procedure to place the commands, buttons, and menu items
created by the legacy applications in the PTC Creo Parametric ribbon user
interface. Refer to the PTC Creo Parametric Help for more information on the
ribbon user interface and the procedure to customize the ribbon.
87
Creating Ribbon Tabs, Groups, and Menu
Items
Customizations to the ribbon user interface using the J-Link applications are
supported through the Customize Ribbon tab in the Creo Parametric Options dialog
box. You can specify the user interface layout for a J-Link application and save
the layout definition in a ribbon definition file, toolkitribbonui.rbn. Set
the configuration option tk_enable_ribbon_custom_save to true
before customizing the ribbon user interface using the J-Link application. When
you run PTC Creo Parametric, the toolkitribbonui.rbn file is loaded
along with the J-Link application and the commands created by the J-Link
application appear in the ribbon user interface. Refer to the section About the
Ribbon Definition File on page 90 for more information on the
toolkitribbonui.rbn file.
You can customize the ribbon user interface only for a particular mode in PTC
Creo Parametric. For example, if you customize the ribbon user interface and save
it to the toolkitribbonui.rbn file in the Part mode, then on loading PTC
Creo Parametric the customized user interface will be visible only in the Part
mode. To view a particular tab or group in all the modes, you must customize the
ribbon user interface and save the toolkitribbonui.rbn file in each mode.
Refer to the PTC Creo Parametric Fundamentals Help for more information on
customizing the ribbon.
Note
You can add a new group to an existing tab or create a new tab using the
Customize Ribbon tab in the Creo Parametric Options dialog box. You will not
be able to modify the tabs or groups that are defined by PTC Creo Parametric.
Note
The instructions explained below are applicable only if the application is
implemented in full asynchronous mode. This is because applications in
simple asynchronous mode cannot handle requests, that is, command
callbacks, from PTC Creo Parametric. Refer to the chapter on Asynchronous
Mode, for more information.
Note
The Save the Auxilliary Application User Interface button is enabled only if
you set the configuration option tk_enable_ribbon_custom_save
to true.
Note
The Save the Auxilliary Application User Interface button is enabled only if
you set the configuration option tk_enable_ribbon_custom_save
to true.
7. Click OK.
Note
You cannot edit the toolkitribbonui.rbn file manually.
Note
◆ The location of the application text directory is specified in the J-Link
registry file.
◆ A J-Link application can load a ribbon definition file only once. After
the application has loaded the ribbon, calls made to the method
pfcSession.Session.RibbonDefinitionfileLoad to
load other ribbon definition files are ignored.
Note
The order in which the commands will be displayed within the group will
depend on the order of loading of the .rbn file for each application.
The following image displays commands added by two J-Link applications to the
same group.
Note
Commands that have not been designated will not have an icon or will have a
generic icon.
Refer to the PTC Creo Parametric Help for more information on customizing the
Ribbon.
This chapter describes the methods provided by J-Link to create and modify
menus, buttons, and pop-up menus in the PTC Creo Parametric user interface.
Refer to the chapter Ribbon Tabs, Groups, and Menu Items on page 87 for more
information. Also, refer to the PTC Creo Parametric Help for more information on
customizing the ribbon user interface.
97
Introduction
The J-Link classes enable you to supplement the PTC Creo Parametric ribbon user
interface.
Once the J-Link application is loaded, you can add a new group to an existing tab
or create a new tab using the Customize Ribbon tab in the Creo Parametric Options
dialog box in PTC Creo Parametric. You will not be able to modify the groups that
are defined by PTC Creo Parametric. If the translated messages are available for
the newly added tabs or groups, then PTC Creo Parametric will use them by
searching for the same string in the list of sting based messages loaded.
You can customize the ribbon user interface only for a particular mode in PTC
Creo Parametric. For example, if you customize the ribbon user interface and save
it to the toolkitribbonui.rbn file in the Part mode, then on loading PTC
Creo Parametric the customized user interface will be visible only in the Part
mode. To view a particular tab or group in all the modes, you must customize the
ribbon user interface and save the toolkitribbonui.rbn file in each mode.
Refer to the PTC Creo Parametric Fundamentals Help for more information on
customizing the ribbon.
Note
Refer to the chapter on Ribbon Tabs, Groups, and Menu Items on page 87
for more information. Also, refer to the PTC Creo Parametric Parametic
Help for more information on customizing the Ribbon User Interface.
4. Save the configuration in PTC Creo Parametric so that changes to the ribbon
user interface appear when a new session of PTC Creo Parametric is started.
Command Icons
Method Introduced:
• pfcCommand.UICommand.SetIcon
The method pfcCommand.UICommand.SetIcon allows you to designate an
icon to be used with the command you created. The method adds the icon to the
PTC Creo Parametric command. Specify the name of the icon file, including the
extension as the input argument for this method. A valid format for the icon file is
a standard .GIF, .JPG, or.PNG. PTC recommends using .PNG format. All
icons in the Creo Parametric ribbon are either 16x16 (small) or 32x32 (large)
size. The naming convention for the icons is as follows:
• Small icon—<iconname.ext>
• Large icon—<iconname_large.ext>
The application searches for the icon files in the following locations:
• <creo_loadpoint>\<datecode>\Common Files\text\
resource
• <Application text dir>\resource
• <Application text dir>\<language>\resource
The location of the application text directory is specified in the registry file.
Commands that do not have an icon assigned to them display the button label.
You may also use this method to assign a small icon to a button. The icon appears
to the left of the button label.
Note
This file must be in the directory <text_path>/text or <text_
path>/text/<language>.
Pop-up Menus
PTC Creo Parametric provides shortcut menus that contain frequently used
commands appropriate to the currently selected items. You can access a shortcut
menu by right-clicking a selected item. Shortcut menus are accessible in:
• Graphics window
• Model Tree
• Some dialog boxes
• Any area where you can perform an object-action operation by selecting an
item and choosing a command to perform on the selected item.
The methods described in this section allow you to add menus to a graphics
window pop-up menu.
This chapter describes how to program on the model level using J-Link.
109
Overview of Model Objects
Models can be any PTC Creo Parametric file type, including parts, assemblies,
drawings, sections, and notebook. The classes and methods in the package
com.ptc.pfc.pfcModel provide generic access to models, regardless of
their type. The available methods enable you to do the following:
• Access information about a model.
• Open, copy, rename, and save a model.
Model Descriptors
Methods Introduced:
Note
You are allowed to set other fields in the model descriptor object, but they may
be ignored by some methods.
Models 111
Retrieving Models
Methods Introduced:
• pfcSession.BaseSession.RetrieveModel
• pfcSession.BaseSession.RetrieveModelWithOpts
• pfcSession.BaseSession.OpenFile
• pfcSolid.Solid.HasRetrievalErrors
These methods cause PTC Creo Parametric to retrieve the model that corresponds
to the ModelDescriptor argument.
The method pfcSession.BaseSession.RetrieveModel retrieves the
specified model into the PTC Creo Parametric session given its model descriptor
from a standard directory. This method ignores the path argument specified in the
model descriptor. But this method does not create a window for it, nor does it
display the model anywhere.
The method pfcSession.BaseSession.RetrieveModelWithOpts
retrieves the specified model into the PTC Creo Parametric session based on the
path specified by the model descriptor. The path can be a disk path, a workspace
path, or a commonspace path. The Opts argument (given by the
Session.RetrieveModelOptions object) provides the user with the
option to specify simplified representations.
The method pfcSession.BaseSession.OpenFile brings the model into
memory, opens a new window for it (or uses the base window, if it is empty), and
displays the model.
Note
pfcSession.BaseSession.OpenFile actually returns a handle to the
window it has created.
Model Information
Methods Introduced:
Models 113
The method pfcModel.Model.GetInstanceName retrieves the name of
the model. If the model is an instance, this method retrieves the instance name.
The method pfcModel.Model.GetOrigin returns the complete path to the
file from which the model was opened. This path can be a location on disk from a
PTC Windchill workspace, or from a downloaded URL.
The method pfcModel.Model.GetRelationId retrieves the relation
identifier of the specified model. It can be NULL.
The method pfcModel.Model.GetDescr returns the descriptor for the
specified model. Model descriptors can be used to represent models not currently
in session.
Note
From Pro/ENGINEER Wildfire 4.0 onwards, the methodsproperties
pfcModel.Model.GetFullName,
pfcModel.Model.GetGenericName, and
pfcModel.Model.GetDescr throw an exception
pfcExceptions.XtoolkitCantOpen if called on a model instance
whose immediate generic is not in session. Handle this exception and typecast
the model as pfcSolid.Solid, which in turn can be typecast as
pfcFamily.FamilyMember, and use the method
pfcFamily.FamilyMember.GetImmediateGenericInfo to get the
model descriptor of the immediate generic model. The model descriptor can be
used to derive the full name or generic name of the model. If you wish to
switch off this behavior and continue to run legacy applications in the pre-
Wildfire 4.0 mode, set the configuration option retrieve_instance_
dependencies to instance_and_generic_deps.
Note
J-Link methods will only be able to read models of type Layout, but will
not be able to pass Layout models as input to other methods. PTC
recommends that you review all J-Link applications that use the object
pfcModel.ModelType and modify the code as appropriate to ensure
that the applications work correctly.
Note
Do not call the method pfcModel.Model.CleanupDependencies
during operations that alter the dependencies, such as, restructuring
components and creating or redefining features.
Models 115
The method pfcModel.Model.CheckIsModifiable identifies if a given
model can be modified without checking for any subordinate models. This method
takes a boolean argument ShowUI that determines whether the PTC Creo
Parametric conflict resolution dialog box should be displayed to resolve conflicts,
if detected. If this argument is false, then the conflict resolution dialog box is not
displayed, and the model can be modified only if there are no conflicts that cannot
be overridden, or are resolved by default resolution actions. For a generic model,
if ShowUI is true, then all instances of the model are also checked.
The method pfcModel.Model.CheckIsSaveAllowed identifies if a given
model can be saved along with all of its subordinate models. The subordinate
models can be saved based on their modification status and the value of the
configuration option save_objects. This method also checks the current user
interface context to identify if it is currently safe to save the model. Thus, calling
this method at different times might return different results. This method takes a
boolean argument ShowUI. Refer to the previous method for more information on
this argument.
Model Operations
Methods Introduced:
• pfcModel.Model.Backup
• pfcModel.Model.Copy
• pfcModel.Model.CopyAndRetrieve
• pfcModel.Model.Rename
• pfcModel.Model.Save
• pfcModel.Model.Erase
• pfcModel.Model.EraseWithDependencies
• pfcModel.Model.Delete
• pfcModel.Model.Display
• pfcModel.Model.SetCommonName
These model operations duplicate most of the commands available in the PTC
Creo Parametric File menu.
The method pfcModel.Model.Backup makes a backup of an object in
memory to a disk in a specified directory.
The method pfcModel.Model.Copy copies the specified model to another
file.
The method pfcModel.Model.CopyAndRetrieve copies the model to
another name, and retrieves that new model into session.
The method pfcModel.Model.Rename renames a specified model.
Note
However, while erasing an active model, pfcModel.Model.Erase and
pfcModel.Model.EraseWithDependencies only clear the graphic
display immediately, they do not clear the data in the memory until the control
returns to PTC Creo Parametric from the J-Link application. Therefore, after
calling them the control must be returned to PTC Creo Parametric before
calling any other function, otherwise the behavior of PTC Creo Parametric
may be unpredictable.
Models 117
• pfcModelCheck.ModelCheckInstructions.SetOutputDir
• pfcModelCheck.ModelCheckInstructions.SetShowInBrowser
• pfcModelCheck.ModelCheckResults.GetNumberOfErrors
• pfcModelCheck.ModelCheckResults.GetNumberOfWarnings
• pfcModelCheck.ModelCheckResults.GetWasModelSaved
You can run PTC Creo Modelcheck from an external application using the method
pfcSession.BaseSession.ExecuteModelCheck. This method takes
the model Model on which you want to run PTC Creo Modelcheck and
instructions in the form of the object ModelCheckInstructions as its input
parameters. This object contains the following parameters:
• ConfigDir—Specifies the location of the configuration files. If this
parameter is set to NULL, the default PTC Creo Modelcheck configuration
files are used.
• Mode—Specifies the mode in which you want to run PTC Creo Modelcheck.
The modes are:
○ MODELCHECK_GRAPHICS—Interactive mode
○ MODELCHECK_NO_GRAPHICS—Batch mode
• OutputDir—Specifies the location for the reports. If you set this parameter
to NULL, the default PTC Creo Modelcheck directory, as per config_
init.mc, will be used.
• ShowInBrowser—Specifies if the results report should be displayed in the
Web browser.
The method
pfcModelCheck.pfcModelCheck.ModelCheckInstructions_
Create creates the ModelCheckInstructions object containing the PTC
Creo Modelcheck instructions described above.
Use the methods
pfcModelCheck.ModelCheckInstructions.SetConfigDir,
pfcModelCheck.ModelCheckInstructions.SetMode,
pfcModelCheck.ModelCheckInstructions.SetOutputDir, and
pfcModelCheck.ModelCheckInstructions.SetShowInBrowser to
modify the PTC Creo Modelcheck instructions.
The method pfcSession.BaseSession.ExecuteModelCheck returns
the results of the PTC Creo Modelcheck run in the form of the
ModelCheckResults object. This object contains the following parameters:
• NumberOfErrors—Specifies the number of errors detected.
• NumberOfWarnings—Specifies the number of warnings found.
• WasModelSaved—Specifies whether the model is saved with updates.
Models 119
11
Drawings
Overview of Drawings in J-Link................................................................................. 122
Creating Drawings from Templates ........................................................................... 122
Obtaining Drawing Models ....................................................................................... 124
Drawing Information ................................................................................................ 125
Drawing Operations................................................................................................. 125
Drawing Sheets....................................................................................................... 127
Drawing Views ........................................................................................................ 130
Drawing Dimensions................................................................................................ 135
Drawing Tables ....................................................................................................... 142
Detail Items............................................................................................................. 149
Detail Entities.......................................................................................................... 151
OLE Objects ........................................................................................................... 154
Detail Notes ............................................................................................................ 154
Detail Groups.......................................................................................................... 158
Detail Symbols ........................................................................................................ 160
Detail Attachments .................................................................................................. 172
121
Overview of Drawings in J-Link
This section describes the functions that deal with drawings. You can create
drawings of all PTC Creo Parametric models using the functions in J-Link. You
can annotate the drawing, manipulate dimensions, and use layers to manage the
display of different items.
Unless otherwise specified, J-Link functions that operate on drawings use world
units.
Note
When this exception type is encountered, the drawing is actually created, but
some of the contents failed to generate correctly.
The error structure contains an array of drawing creation errors. Each error
message may have the following elements:
• Type—The type of error as follows:
○ DWGCREATE_ERR_SAVED_VIEW_DOESNT_EXIST—Saved view does
not exist.
○ DWGCREATE_ERR_X_SEC_DOESNT_EXIST—Specified cross section
does not exist.
○ DWGCREATE_ERR_EXPLODE_DOESNT_EXIST—Exploded state did
not exist.
○ DWGCREATE_ERR_MODEL_NOT_EXPLODABLE—Model cannot be
exploded.
○ DWGCREATE_ERR_SEC_NOT_PERP—Cross section view not
perpendicular to the given view.
○ DWGCREATE_ERR_NO_RPT_REGIONS—Repeat regions not available.
○ DWGCREATE_ERR_FIRST_REGION_USED—Repeat region was unable
to use the region specified.
○ DWGCREATE_ERR_NOT_PROCESS_ASSEM— Model is not a process
assembly view.
Drawings 123
○ DWGCREATE_ERR_NO_STEP_NUM—The process step number does not
exist.
○ DWGCREATE_ERR_TEMPLATE_USED—The template does not exist.
○ DWGCREATE_ERR_NO_PARENT_VIEW_FOR_PROJ—There is no
possible parent view for this projected view.
○ DWGCREATE_ERR_CANT_GET_PROJ_PARENT—Could not get the
projected parent for a drawing view.
○ DWGCREATE_ERR_SEC_NOT_PARALLEL—The designated cross
section was not parallel to the created view.
○ DWGCREATE_ERR_SIMP_REP_DOESNT_EXIST—The designated
simplified representation does not exist.
• ViewName—Name of the view where the error occurred.
• SheetNumber—Sheet number where the error occurred.
• ObjectName—Name of the invalid or missing object.
• View—2D view in which the error occurred.
Use the method
pfcExceptions.XToolkitDrawingCreateErrors.GetErrors to
obtain the preceding array elements from the error object.
Drawing Information
Methods Introduced:
• pfcModel2D.Model2D.ListModels
• pfcModel2D.Model2D.GetCurrentSolid
• pfcModel2D.Model2D.ListSimplifiedReps
• pfcModel2D.Model2D.GetTextHeight
The method pfcModel2D.Model2D.ListModels returns a list of all the
solid models used in the drawing.
The method pfcModel2D.Model2D.GetCurrentSolid returns the current
solid model of the drawing.
The method pfcModel2D.Model2D.ListSimplifiedReps returns the
simplified representations of a solid model that are assigned to the drawing.
The method pfcModel2D.Model2D.GetTextHeight returns the text
height of the drawing.
Drawing Operations
Methods Introduced:
• pfcModel2D.Model2D.AddModel
• pfcModel2D.Model2D.DeleteModel
• pfcModel2D.Model2D.ReplaceModel
• pfcModel2D.Model2D.SetCurrentSolid
• pfcModel2D.Model2D.AddSimplifiedRep
• pfcModel2D.Model2D.DeleteSimplifiedRep
• pfcModel2D.Model2D.Regenerate
• pfcModel2D.Model2D.SetTextHeight
• pfcModel2D.Model2D.CreateDrawingDimension
• pfcModel2D.Model2D.CreateView
Drawings 125
The method pfcModel2D.Model2D.AddModel adds a new solid model to
the drawing.
The method pfcModel2D.Model2D.DeleteModel removes a model from
the drawing. The model to be deleted should not appear in any of the drawing
views.
The method pfcModel2D.Model2D.ReplaceModel replaces a model in
the drawing with a related model (the relationship should be by family table or
interchange assembly). It allows you to replace models that are shown in drawing
views and regenerates the view.
The method pfcModel2D.Model2D.SetCurrentSolid assigns the
current solid model for the drawing. Before calling this method, the solid model
must be assigned to the drawing using the method
pfcModel2D.Model2D.AddModel. To see the changes to parameters and
fields reflecting the change of the current solid model, regenerate the drawing
using the method pfcSheet.SheetOwner.RegenerateSheet.
The method pfcModel2D.Model2D.AddSimplifiedRep associates the
drawing with the simplified representation of an assembly
The method pfcModel2D.Model2D.DeleteSimplifiedRep removes the
association of the drawing with an assembly simplified representation. The
simplified representation to be deleted should not appear in any of the drawing
views.
Use the method pfcModel2D.Model2D.Regenerate to regenerate the
drawing draft entities and appearance.
The method pfcModel2D.Model2D.SetTextHeight ets the value of the
text height of the drawing.
The method pfcModel2D.Model2D.CreateDrawingDimension creates
a new drawing dimension based on the data object that contains information about
the location of the dimension. This method returns the created dimension. Refer to
the section Drawing Dimensions on page 135.
The method pfcModel2D.Model2D.CreateView creates a new drawing
view based on the data object that contains information about how to create the
view. The method returns the created drawing view. Refer to the section Creating
Drawing Views on page 130.
Note
These identifiers may change if the sheets are moved as a consequence of
adding, removing or reordering sheets.
Drawings 127
The method pfcSheet.SheetOwner.GetSheetScale returns the scale of
the drawing on a particular sheet based on the drawing model used to measure the
scale. If no models are used in the drawing then the default scale value is 1.0.
The method pfcSheet.SheetOwner.GetSheetFormat returns the
drawing format used for the sheet specified by the sheet number. It returns a null
value if no format is assigned to the sheet.
The method pfcSheet.SheetOwner.GetSheetFormatDescr returns the
model descriptor of the drawing format used for the specified drawing sheet.
The method pfcSheet.SheetOwner.GetSheetBackgroundView
returns the view object representing the background view of the sheet specified by
the sheet number.
The method pfcSheet.SheetOwner.GetNumberOfSheets returns the
number of sheets in the model.
The method pfcSheet.SheetOwner.GetCurrentSheetNumber returns
the current sheet number in the model.
Note
The sheet numbers range from 1 to n, where n is the number of sheets.
Note
The sheet number of other affected sheets also changes due to reordering or
deletion.
Note
You can regenerate a sheet only if it is displayed.
Drawings 129
Drawing Views
A drawing view is represented by the pfcView2D.View2D. All model views
in the drawing are associative, that is, if you change a dimensional value in one
view, the system updates other drawing views accordingly. The model
automatically reflects any dimensional changes that you make to a drawing. In
addition, corresponding drawings also reflect any changes that you make to a
model such as the addition or deletion of features and dimensional changes.
Drawings 131
Use the method
pfcView2D.ProjectionViewCreateInstructions.SetLocation
to assign the location of the projected drawing view. This location determines how
the drawing view will be oriented.
Use the method
pfcView2D.ProjectionViewCreateInstructions.SetExploded
to set the created projected drawing view to be an exploded view.
Note
This method works for solid and drawing dimensions.
Drawings 133
The method pfcView2D.View2D.GetDisplay returns an output structure
that describes the display settings of the drawing view. The fields in the structure
are as follows:
• Style—Whether to display as wireframe, hidden lines, no hidden lines, or
shaded
• TangentStyle—Linestyle used for tangent edges
• CableStyle—Linestyle used to display cables
• RemoveQuiltHiddenLines—Whether or not to apply hidden-line-removal to
quilts
• ShowConceptModel—Whether or not to display the skeleton
• ShowWeldXSection—Whether or not to include welds in the cross-section
The method pfcView2D.View2D.GetTransform returns a matrix that
describes the transform between 3D solid coordinates and 2D world units for that
drawing view. The transformation matrix is a combination of the following
factors:
• The location of the view origin with respect to the drawing origin.
• The scale of the view units with respect to the drawing units
• The rotation of the model with respect to the drawing coordinate system.
The method pfcView2D.View2D.GetName returns the name of the specified
view in the drawing.
The simplified representations of assembly and part can be used as drawing
models to create general views. Use the method
pfcView2D.View2D.GetSimpRep to retrieve the simplified representation
for the specified view in the drawing.
Drawing Dimensions
This section describes the J-Link methods that give access to the types of
dimensions that can be created in the drawing mode. They do not apply to
dimensions created in the solid mode, either those created automatically as a result
of feature creation, or reference dimension created in a solid. A drawing
dimension or a reference dimension shown in a drawing is represented by the
com.ptc.pfc.pfcDimension2D.Dimension2D.
Drawings 135
Set the parameter Type to the type of drawing dimension to retrieve. If this
parameter is set to null, then all the dimensions in the drawing are listed.
The method pfcModelItem.ModelItemOwner.GetItemById returns a
drawing dimension based on the type and the integer identifier. The method
returns only those dimensions created in the drawing. It returns a null if a drawing
dimension with the specified attributes is not found.
The method pfcSelect.Selection.GetSelItem returns the value of the
selected drawing dimension.
Drawings 137
The method
pfcDimension2D.pfcDimension2D.SplinePointDimension
Sense_Create creates a dimension sense associated with the type
DIMSENSE_SPLINE_PT. This means that the attachment is to a point on a
spline. The sense field is set to SplinePointIndex i.e., the index of the spline
point.
The method
pfcDimension2D.pfcDimension2D.TangentIndexDimension
Sense_Create creates a new dimension sense associated with the type
DIMSENSE_TANGENT_INDEX. The attachment is to a tangent of the entity,
which is an arc or a circle. The sense field is set to TangentIndex, i.e., the index
of the tangent of the entity.
The method
pfcDimension2D.pfcDimension2D.LinAOCTangentDimension
Sense_Create creates a new dimension sense associated with the type
DIMSENSE_LINEAR_TO_ARC_OR_CIRCLE_TANGENT. The dimension is the
perpendicular distance between the a line and a tangent to an arc or a circle that is
parallel to the line. The sense field is set to the value of the parameter
TangentType.
The possible values of TangentType are:
• DIMLINAOCTANGENT_LEFT0—The tangent is to the left of the line, and is
on the same side, of the center of the arc or circle, as the line.
• DIMLINAOCTANGENT_RIGHT0—The tangent is to the right of the line, and
is on the same side, of the center of the arc or circle, as the line.
• DIMLINAOCTANGENT_LEFT1—The tangent is to the left of the line, and is
on the opposite side of the line.
• DIMLINAOCTANGENT_RIGHT1— The tangent is to the right of the line, and
is on the opposite side of the line.
The method
pfcDimension2D.pfcDimension2D.AngleDimensionSense_
Create creates a new dimension sense associated with the type DIMSENSE_
ANGLE. The dimension is the angle between two straight entities. The sense
field is set to the value of the parameter AngleOptions.
The possible values of AngleOptions are:
• IsFirst—Is set to TRUE if the angle dimension starts from the specified
entity in a counterclockwise direction. Is set to FALSE if the dimension ends
at the specified entity. The value is TRUE for one entity and FALSE for the
other entity forming the angle.
• ShouldFlip—If the value of ShouldFlip is FALSE, and the direction of
the specified entity is away from the vertex of the angle, then the dimension
Drawings 139
The method pfcDimension2D.Dimension2D.GetAttachmentPoints
returns a sequence of attachment points. The dimension senses array returned by
the method pfcDimension2D.Dimension2D.GetDimensionSenses
gives more information on how these attachments are interpreted.
The method pfcDimension2D.Dimension2D.GetDimensionSenses
returns a sequence of dimension senses, describing how the dimension is attached
to each attachment returned by the method
pfcDimension2D.Dimension2D.GetAttachmentPoints.
The method pfcDimension2D.Dimension2D.GetOrientationHint
returns the orientation hint for placing the drawing dimensions. The orientation
hint determines how PTC Creo Parametric will orient the dimension with respect
to the attachment points.
Note
This methods described above are applicable only for dimensions created in
the drawing mode. It does not support dimensions created at intersection
points of entities.
The method
pfcDimension2D.Dimension2D.GetBaselineDimension returns an
ordinate baseline drawing dimension. It returns a null value if the dimension is not
an ordinate dimension.
Note
The method updates the display of the dimension only if it is currently
displayed.
Note
The method updates the display of the dimension only if it is currently
displayed.
Drawings 141
Example: Command Creation of Dimensions from Model
Datum Points
The sample code in the file pfcDrawingExamples.java located at <creo_
jlink_loadpoint>/jlink_appls/jlinkexamples shows a command
which creates vertical and horizontal ordinate dimensions from each datum point
in a model in a drawing view to a selected coordinate system datum.
Drawing Tables
A drawing table in J-Link is represented by the
com.ptc.pfc.pfcTable.Table. It is a child of the ModelItem .
Some drawing table methods operate on specific rows or columns. The row and
column numbers in J-Link begin with 1 and range up to the total number of rows
or columns in the table. Some drawing table methods operate on specific table
cells. The com.ptc.pfc.pfcTable.TableCell is used to represent a
drawing table cell.
Drawings 143
• pfcTable.TableRetrieveInstructions.SetReferenceRep
• pfcTable.TableOwner.RetrieveTable
• pfcTable.TableOwner.RetrieveTableByOrigin
The method pfcTable.TableOwner.RetrieveTable retrieves a table
specified by the TableRetrieveInstructions data object from a file on
the disk. It returns the retrieved table. The data object contains information on the
table to retrieve and is returned by the method
pfcTable.pfcTable.TableRetrieveInstructions_Create.
The method pfcTable.pfcTable.TableRetrieveInstructions_
Create creates the TableRetrieveInstructions data object that
describes how to retrieve a drawing table using the methods
pfcTable.TableOwner.RetrieveTable and
pfcTable.TableOwner.RetrieveTableByOrigin. The method returns
the created instructions data object.
The parameters of the instruction object are:
• FileName—Name of the file containing the drawing table.
• Position—Coordinates of the point on the drawing sheet, where the retrieved
table must be placed. You must specify the value in screen coordinates.
You can also set the parameters for TableRetrieveInstructions data
object using the following method:
• pfcTable.TableRetrieveInstructions.SetFileName—Sets
the name of the drawing table. You must not specify the extension.
• pfcTable.TableRetrieveInstructions.SetPath—Sets the path
to the drawing table file. The path must be specified relative to the working
directory.
• pfcTable.TableRetrieveInstructions.SetVersion—Sets the
version of the drawing table that must be retrieved. If you specify NULL rthe
latest version of the drawing table is retrieved.
• pfcTable.TableRetrieveInstructions.SetPosition—Sets
the coordinates of the point on the drawing sheet, where the table must be
placed. You must specify the value in screen coordinates.
• pfcTable.TableRetrieveInstructions.SetReferenceSol
id—Sets the model from which data must be copied into the drawing table. If
this argument is passed as NULL, an empty table is created.
• pfcTable.TableRetrieveInstructions.SetReferenceRep—
Sets the handle to the simplified representation in a solid, from which data
must be copied into the drawing table. If this argument is passed as NULL, and
the argument solid is not NULL, then data from the solid model is copied into
the drawing table
Drawings 145
The method pfcTable.Table.GetColumnSize returns the width of the
drawing table column specified by the segment identifier and the column number.
The method pfcTable.Table.GetText returns the sequence of text in a
drawing table cell. Set the value of the parameter Mode to DWGTABLE_NORMAL
to get the text as displayed on the screen. Set it to DWGTABLE_FULL to get
symbolic text, which includes the names of parameter references in the table text.
The method pfcTable.Table.GetCellNote returns the detail note item
contained in the table cell.
Note
Many of the above methods provide a parameter Repaint If this is set to true
the table will be repainted after the change. If set to false or null PTC Creo
Parametric will delay the repaint, allowing you to perform several operations
before showing changes on the screen.
Drawings 147
• pfcSelect.Selection.GetSelTableSegment
• pfcTable.Table.GetSegmentCount
• pfcTable.Table.GetSegmentSheet
• pfcTable.Table.MoveSegment
• pfcTable.Table.GetInfo
The method pfcSelect.Selection.GetSelTableSegment returns the
value of the segment identifier of the selected table segment. It returns a null value
if the selection does not contain a segment identifier.
The method pfcTable.Table.GetSegmentCount returns the number of
segments in the table.
The method pfcTable.Table.GetSegmentSheet determines the sheet
number that contains a specified drawing table segment.
The method pfcTable.Table.MoveSegment moves a drawing table
segment to a new location. Pass the co-ordinates of the target position in the
format x, y, z=0.
Note
Set the value of the parameter Repaint to true to repaint the drawing with the
changes. Set it to false or null to delay the repaint.
To get information about a drawing table pass the value of the segment identifier
as input to the method pfcTable.Table.GetInfo. The method returns the
table information including the rotation, row and column information, and the 3D
outline.
Repeat Regions
Methods Introduced:
• pfcTable.Table.IsCommentCell
• pfcTable.Table.GetCellComponentModel
• pfcTable.Table.GetCellReferenceModel
• pfcTable.Table.GetCellTopModel
• pfcTable.TableOwner.UpdateTables
The methods pfcTable.Table.IsCommentCell,
pfcTable.Table.GetCellComponentModel,
pfcTable.Table.GetCellReferenceModel,
Detail Items
The methods described in this section operate on detail items.
In J-Link you can create, delete and modify detail items, control their display, and
query what detail items are present in the drawing. The types of detail items
available are:
• Draft Entities—Contain graphical items created in PTC Creo Parametric. The
items are as follows:
○ Arc
○ Ellipse
○ Line
○ Point
○ Polygon
○ Spline
• Notes—Textual annotations
• Symbol Definitions—Contained in the drawing’s symbol gallery.
• Symbol Instances—Instances of a symbol placed in a drawing.
Drawings 149
• Draft Groups—Groups of detail items that contain notes, symbol instances,
and draft entities.
• OLE objects—Object Linking and Embedding (OLE) objects embedded in the
PTC Creo Parametric drawing file.
Detail Entities
A detail entity in J-Link is represented by the
com.ptc.pfc.pfcDetail.DetailEntityItem. It is a child of the
DetailItem .
The com.ptc.pfc.pfcDetail.DetailEntityInstructions
contains specific information used to describe a detail entity item.
Instructions
Methods Introduced:
• pfcDetail.pfcDetail.DetailEntityInstructions_Create
• pfcDetail.DetailEntityInstructions.GetGeometry
• pfcDetail.DetailEntityInstructions.SetGeometry
• pfcDetail.DetailEntityInstructions.GetIsConstruction
• pfcDetail.DetailEntityInstructions.SetIsConstruction
• pfcDetail.DetailEntityInstructions.GetColor
• pfcDetail.DetailEntityInstructions.SetColor
• pfcDetail.DetailEntityInstructions.GetFontName
• pfcDetail.DetailEntityInstructions.SetFontName
• pfcDetail.DetailEntityInstructions.GetWidth
• pfcDetail.DetailEntityInstructions.SetWidth
• pfcDetail.DetailEntityInstructions.GetView
• pfcDetail.DetailEntityInstructions.SetView
The method pfcDetail.pfcDetail.DetailEntityInstructions_
Create creates an instructions object that describes how to construct a detail
entity, for use in the methods
Drawings 151
pfcDetail.DetailItemOwner.CreateDetailItem,
pfcDetail.DetailSymbolDefItem.CreateDetailItem, and
pfcDetail.DetailEntityItem.Modify.
The instructions object is created based on the curve geometry and the drawing
view associated with the entity. The curve geometry describes the trajectory of the
detail entity in world units. The drawing view can be a model view returned by the
method pfcModel2D.Model2D.List2DViews or a drawing sheet
background view returned by the method
pfcSheet.SheetOwner.GetSheetBackgroundView. The background
view indicates that the entity is not associated with a particular model view.
The method returns the created instructions object.
Note
Changes to the values of a pfcDetail.DetailEntityInstructions
object do not take effect until that instructions object is used to modify the
entity using pfcDetail.DetailEntityItem.Modify.
Drawings 153
The method pfcDetail.DetailEntityItem.Modify modifies the
definition of an entity item using the specified instructions data object.
OLE Objects
An object linking and embedding (OLE) object is an external file, such as a
document, graphics file, or video file that is created using an external application
and which can be inserted into another application, such as PTC Creo Parametric.
You can create and insert supported OLE objects into a two-dimensional PTC
Creo Parametric file, such as a drawing, report, format file, notebook, or diagram.
The functions described in this section enable you to identify and access OLE
objects embedded in drawings.
Methods Introduced:
• pfcDetail.DetailOLEObject.GetApplicationType
• pfcDetail.DetailOLEObject.GetOutline
• pfcDetail.DetailOLEObject.GetPath
• pfcDetail.DetailOLEObject.GetSheet
The method pfcDetail.DetailOLEObject.GetApplicationType
returns the type of the OLE object as a string, for example, Microsoft Word
Document.
The method pfcDetail.DetailOLEObject.GetOutline returns the
extent of the OLE object embedded in the drawing.
The method pfcDetail.DetailOLEObject.GetPath returns the path to
the external file for each OLE object, if it is linked to an external file.
The method pfcDetail.DetailOLEObject.GetSheet returns the sheet
number for the OLE object.
Detail Notes
A detail note in is represented by the
com.ptc.pfc.pfcDetail.DetailNoteItem. It is a child of the
DetailItem .
The com.ptc.pfc.pfcDetail.DetailNoteInstructions contains
specific information that describes a detail note.
Instructions
Methods Introduced:
Note
Changes to the values of apfcDetail.DetailNoteInstructions
object do not take effect until that instructions object is used to modify the
note using pfcDetail.DetailNoteItem.Modify
Drawings 155
The method pfcDetail.DetailNoteInstructions.SetTextLines
sets the description of the text line contents in the note.
The method
pfcDetail.DetailNoteInstructions.GetIsDisplayed returns a
boolean indicating if the note is currently displayed.
The method
pfcDetail.DetailNoteInstructions.SetIsDisplayed sets the
display flag for the note.
The method pfcDetail.DetailNoteInstructions.GetIsReadOnly
determines whether the note can be edited by the user, while the method
pfcDetail.DetailNoteInstructions.SetIsReadOnly toggles the
read only status of the note.
The method pfcDetail.DetailNoteInstructions.GetIsMirrored
determines whether the note is mirrored, while the method
pfcDetail.DetailNoteInstructions.SetIsMirrored toggles the
mirrored status of the note.
The method pfcDetail.DetailNoteInstructions.GetHorizontal
returns the value of the horizontal justification of the note, while the method
pfcDetail.DetailNoteInstructions.SetHorizontal sets the
value of the horizontal justification of the note.
The method pfcDetail.DetailNoteInstructions.GetVertical
returns the value of the vertical justification of the note, while the method
pfcDetail.DetailNoteInstructions.SetVertical sets the value
of the vertical justification of the note.
The method pfcDetail.DetailNoteInstructions.GetColor returns
the color of the detail note item. The method returns a null value to represent the
default drawing color.
Use the method pfcDetail.DetailNoteInstructions.SetColor to
set the color of the detail note item. Pass null to use the default drawing color.
The method pfcDetail.DetailNoteInstructions.GetLeader
returns the locations of the detail note item and information about the leaders.
The method pfcDetail.DetailNoteInstructions.SetLeader sets
the values of the location of the detail note item and the locations where the
leaders are attached to the drawing.
The method pfcDetail.DetailNoteInstructions.GetTextAngle
returns the value of the angle of the text used in the note. The method returns a
null value if the angle is 0.0.
The method pfcDetail.DetailNoteInstructions.SetTextAngle
sets the value of the angle of the text used in the note. Pass null to use the angle
0.0.
Note
PTC Creo Parametric does not resolve and replace symbolic callouts for notes
which are not displayed. Therefore, if the note is not displayed or is hidden in
a layer, the text retrieved may contain symbolic callouts, even when
GiveParametersAsNames is false.
Drawings 157
The ordering of the points is maintained even if the notes are mirrored or are at an
angle.
The method pfcDetail.DetailNoteItem.GetModelReference
returns the model referenced by the parameterized text in a note. The model is
referenced based on the line number and the text index where the parameterized
text appears.
Detail Groups
A detail group in J-Link is represented by the
com.ptc.pfc.pfcDetail.DetailGroupItem. It is a child of the
DetailItem .
The interface com.ptc.pfc.pfcDetail.DetailGroupInstructions
contains information used to describe a detail group item.
Instructions
Method Introduced:
Note
Changes to the values of a pfcDetail.DetailGroupInstructions
object do not take effect until that instructions object is used to modify the
group using pfcDetail.DetailGroupItem.Modify.
Drawings 159
• pfcDetail.DetailGroupItem.GetInstructions
The method pfcDetail.DetailGroupItem.GetInstructions gets a
data object that describes how to construct a detail group item. The method returns
the data object describing the detail group item.
Detail Symbols
Detail Symbol Definitions
A detail symbol definition in J-Link is represented by the
pfcDetail.DetailSymbolDefItem. It is a child of the DetailItem .
The interface pfcDetail.DetailSymbolDefInstructions contains
information that describes a symbol definition. It can be used when creating
symbol definition entities or while accessing existing symbol definition entities.
Instructions
Methods Introduced:
• pfcDetail.pfcDetail.DetailSymbolDefInstructions_Create
• pfcDetail.DetailSymbolDefInstructions.GetSymbolHeight
Note
Changes to the values of a
pfcDetail.DetailSymbolDefInstructions object do not take
effect until that instructions object is used to modify the definition using the
method pfcDetail.DetailSymbolDefItem.Modify.
The method
pfcDetail.DetailSymbolDefInstructions.GetSymbolHeight
returns the value of the height type for the symbol definition. The symbol
definition height options are as follows:
• SYMDEF_FIXED—Symbol height is fixed.
• SYMDEF_VARIABLE—Symbol height is variable.
• SYMDEF_RELATIVE_TO_TEXT—Symbol height is determined relative to
the text height.
The method
pfcDetail.DetailSymbolDefInstructions.SetSymbolHeight
sets the value of the height type for the symbol definition.
Drawings 161
The method
pfcDetail.DetailSymbolDefInstructions.GetHasElbow
determines whether the symbol definition includes an elbow.
The method
pfcDetail.DetailSymbolDefInstructions.SetHasElbow decides
if the symbol definition should include an elbow.
The method
pfcDetail.DetailSymbolDefInstructions.GetIsTextAngle
Fixed returns whether the text of the angle is fixed.
The method
pfcDetail.DetailSymbolDefInstructions.SetIsTextAngle
Fixed toggles the requirement that the text angle be fixed.
The method
pfcDetail.DetailSymbolDefInstructions.GetScaledHeight
returns the height of the symbol definition in inches.
The method
pfcDetail.DetailSymbolDefInstructions.GetAttachments
returns the value of the sequence of the possible instance attachment points for the
symbol definition.
The method
pfcDetail.DetailSymbolDefInstructions.SetAttachments sets
the value of the sequence of the possible instance attachment points for the
symbol definition.
The method
pfcDetail.DetailSymbolDefInstructions.GetFullPath returns
the value of the complete path of the symbol definition file.
The method
pfcDetail.DetailSymbolDefInstructions.SetFullPath sets the
value of the complete path of the symbol definition path.
The method
pfcDetail.DetailSymbolDefInstructions.GetReference returns
the text reference information for the symbol definition. It returns a null value if
the text reference is not used. The text reference identifies the text item used for a
symbol definition which has a height type of SYMDEF_TEXT_RELATED.
The method
pfcDetail.DetailSymbolDefInstructions.SetReference sets
the text reference information for the symbol definition.
Drawings 163
Detail Symbol Instances
A detail symbol instance in J-Link is represented by the
pfcDetail.DetailSymbolInstItem. It is a child of the DetailItem .
The Detail.DetailSymbolInstInstructions contains information
that describes a symbol instance. It can be used when creating symbol instances
and while accessing existing groups.
Instructions
Methods Introduced:
• pfcDetail.pfcDetail.DetailSymbolInstInstructions_Create
• pfcDetail.DetailSymbolInstInstructions.GetIsDisplayed
• pfcDetail.DetailSymbolInstInstructions.SetIsDisplayed
• pfcDetail.DetailSymbolInstInstructions.GetColor
• pfcDetail.DetailSymbolInstInstructions.SetColor
• pfcDetail.DetailSymbolInstInstructions.GetSymbolDef
• pfcDetail.DetailSymbolInstInstructions.SetSymbolDef
• pfcDetail.DetailSymbolInstInstructions.GetAttachOnDefType
• pfcDetail.DetailSymbolInstInstructions.SetAttachOnDefType
• pfcDetail.DetailSymbolInstInstructions.GetDefAttachment
• pfcDetail.DetailSymbolInstInstructions.SetDefAttachment
• pfcDetail.DetailSymbolInstInstructions.GetInstAttachment
• pfcDetail.DetailSymbolInstInstructions.SetInstAttachment
• pfcDetail.DetailSymbolInstInstructions.GetAngle
• pfcDetail.DetailSymbolInstInstructions.SetAngle
• pfcDetail.DetailSymbolInstInstructions.GetScaledHeight
• pfcDetail.DetailSymbolInstInstructions.SetScaledHeight
• pfcDetail.DetailSymbolInstInstructions.GetTextValues
• pfcDetail.DetailSymbolInstInstructions.SetTextValues
• pfcDetail.DetailSymbolInstInstructions.GetCurrentTransform
• pfcDetail.DetailSymbolInstInstructions.SetGroups
The method
pfcDetail.pfcDetail.DetailSymbolInstInstructions_Create
creates a data object that contains information about the placement of a symbol
instance.
The method
pfcDetail.DetailSymbolInstInstructions.GetIsDisplayed
returns a value that specifies whether the instance of the symbol is displayed.
Use the method
pfcDetail.DetailSymbolInstInstructions.SetIsDisplayed to
switch the display of the symbol instance.
The method
pfcDetail.DetailSymbolInstInstructions.GetColor returns the
color of the detail symbol instance. A null value indicates that the default drawing
color is used.
The method
pfcDetail.DetailSymbolInstInstructions.SetColor sets the
color of the detail symbol instance. Pass null to use the default drawing color.
The method
pfcDetail.DetailSymbolInstInstructions.GetSymbolDef
returns the symbol definition used for the instance.
The method
pfcDetail.DetailSymbolInstInstructions.SetSymbolDef sets
the value of the symbol definition used for the instance.
The method
pfcDetail.DetailSymbolInstInstructions.GetAttachOnDef
Type returns the attachment type of the instance. The method returns a null value
if the attachment represents a free attachment. The attachment options are as
follows:
• SYMDEFATTACH_FREE—Attachment on a free point.
• SYMDEFATTACH_LEFT_LEADER—Attachment via a leader on the left side
of the symbol.
• SYMDEFATTACH_RIGHT_LEADER— Attachment via a leader on the right
side of the symbol.
• SYMDEFATTACH_RADIAL_LEADER—Attachment via a leader at a radial
location.
Drawings 165
• SYMDEFATTACH_ON_ITEM—Attachment on an item in the symbol
definition.
• SYMDEFATTACH_NORMAL_TO_ITEM—Attachment normal to an item in
the symbol definition.
The method
pfcDetail.DetailSymbolInstInstructions.SetAttachOnDef
Type sets the attachment type of the instance.
The method
pfcDetail.DetailSymbolInstInstructions.GetDefAttachment
returns the value that represents the way in which the instance is attached to the
symbol definition.
The method
pfcDetail.DetailSymbolInstInstructions.SetDefAttachment
specifies the way in which the instance is attached to the symbol definition.
The method
pfcDetail.DetailSymbolInstInstructions.GetInstAttach
ment returns the value of the attachment of the instance that includes location and
leader information.
The method
pfcDetail.DetailSymbolInstInstructions.SetInstAttach
ment sets value of the attachment of the instance.
The method
pfcDetail.DetailSymbolInstInstructions.GetAngle returns the
value of the angle at which the instance is placed. The method returns a null value
if the value of the angle is 0 degrees.
The method
pfcDetail.DetailSymbolInstInstructions.SetAngle sets the
value of the angle at which the instance is placed.
The method
pfcDetail.DetailSymbolInstInstructions.GetScaledHeight
returns the height of the symbol instance in the owner drawing or model
coordinates. This value is consistent with the height value shown for a symbol
instance in the Properties dialog box in the PTC Creo Parametric User Interface.
The method
pfcDetail.DetailSymbolInstInstructions.SetScaledHeight
sets the value of the height of the symbol instance in the owner drawing or model
coordinates.
The method
pfcDetail.DetailSymbolInstInstructions.GetTextValues
returns the sequence of variant text values used while placing the symbol instance.
The method
pfcDetail.DetailSymbolInstInstructions.SetTextValues sets
the sequence of variant text values while placing the symbol instance.
The method
pfcDetail.DetailSymbolInstInstructions.GetCurrentTrans
form returns the coordinate transformation matrix to place the symbol instance.
The method
pfcDetail.DetailSymbolInstInstructions.SetGroups
DetailSymbolGroupOption
• DETAIL_SYMBOL_GROUP_INTERACTIVE—Symbol groups are
interactively selected for display. This is the default value in the GRAPHICS
mode.
• DETAIL_SYMBOL_GROUP_ALL—All non-exclusive symbol groups are
included for display.
• DETAIL_SYMBOL_GROUP_NONE—None of the non-exclusive symbol
groups are included for display.
• DETAIL_SYMBOL_GROUP_CUSTOM—Symbol groups specified by the
application are displayed.
Refer to the section Detail Symbol Groups on page 169 for more information on
detail symbol groups.
Drawings 167
• pfcDetail.DetailSymbolInstItem.GetInstructions
The method pfcDetail.DetailSymbolInstItem.GetInstructions
returns an instructions data object that describes how to construct a symbol
instance. This method takes a ProBoolean argument, GiveParametersAsNames,
which determines whether symbolic representations of parameters and drawing
properties in the symbol instance should be displayed, or the actual text seen by
the user should be displayed.
Instructions
Methods Introduced:
• pfcDetail.pfcDetail.DetailSymbolGroupInstructions_Create
• pfcDetail.DetailSymbolGroupInstructions.GetItems
• pfcDetail.DetailSymbolGroupInstructions.SetItems
• pfcDetail.DetailSymbolGroupInstructions.GetName
• pfcDetail.DetailSymbolGroupInstructions.SetName
The method
pfcDetail.pfcDetail.DetailSymbolGroupInstructions_
Create creates the pfcDetail.DetailSymbolGroupInstructions
data object that stores the name of the symbol group and the list of detail items to
be included in the symbol group.
Note
Changes to the values of the
pfcDetail.DetailSymbolGroupInstructions data object do not
take effect until this object is used to modify the instance using the method
pfcDetail.DetailSymbolGroup.Modify.
The method
pfcDetail.DetailSymbolGroupInstructions.GetItems returns
the list of detail items included in the symbol group.
The method
pfcDetail.DetailSymbolGroupInstructions.SetItems sets the
list of detail items to be included in the symbol group.
The method
pfcDetail.DetailSymbolGroupInstructions.GetName returns the
name of the symbol group.
Drawings 169
The method
pfcDetail.DetailSymbolGroupInstructions.SetName assigns the
name of the symbol group.
Note
After you set the subgroups of a symbol group as exclusive, only one of the
groups at the indicated level can be active in the model at any time.
The method
pfcDetail.DetailSymbolDefItem.SetSubgroupLevelIndepend
ent makes the subgroups of a symbol group independent at the indicated level in
the symbol definition.
Drawings 171
Note
After you set the subgroups of a symbol group as independent, any number of
groups at the indicated level can be active in the model at any time.
Detail Attachments
A detail attachment in J-Link is represented by the pfcDetail.Attachment.
It is used for the following tasks:
• The way in which a drawing note or a symbol instance is placed in a drawing.
• The way in which a leader on a drawing note or symbol instance is attached.
Method Introduced:
• pfcDetail.Attachment.GetType
The method pfcDetail.Attachment.GetType returns the
pfcDetail.AttachmentTypeobject containing the types of detail
attachments. The detail attachment types are as follows:
• ATTACH_FREE—The attachment is at a free point possibly with respect to a
given drawing view.
• ATTACH_PARAMETRIC—The attachment is to a point on a surface or an
edge of a solid.
• ATTACH_OFFSET—The attachment is offset to another drawing view, to a
model item, or to a 3D model annotation.
• ATTACH_TYPE_UNSUPPORTED—The attachment is to an item that cannot
be represented in PFC at the current time. However, you can still retrieve the
location of the attachment.
Free Attachment
The ATTACH_FREE detail attachment type is represented by the
pfcDetail.FreeAttachment. It is a child of the
pfcDetail.Attachment .
MethodsIntroduced:
• pfcDetail.FreeAttachment.GetAttachmentPoint
• pfcDetail.FreeAttachment.SetAttachmentPoint
• pfcDetail.FreeAttachment.GetView
• pfcDetail.FreeAttachment.SetView
Parametric Attachment
The ATTACH_PARAMETRIC detail attachment type is represented by the
pfcDetail.ParametricAttachment. It is a child of the
pfcDetail.Attachment .
MethodsIntroduced:
• pfcDetail.ParametricAttachment.GetAttachedGeometry
• pfcDetail.ParametricAttachment.SetAttachedGeometry
The method
pfcDetail.ParametricAttachment.GetAttachedGeometry returns
the pfcSelect.Selection object representing the item to which the detail
attachment is attached. This includes the drawing view in which the attachment is
made.
The method
pfcDetail.ParametricAttachment.SetAttachedGeometry
assigns the pfcSelect.Selection object representing the item to which the
detail attachment is attached. This object must include the target drawing view.
The attachment will occur at the selected parameters.
Offset Attachment
The ATTACH_OFFSET detail attachment type is represented by the
pfcDetail.OffsetAttachment. It is a child of the
pfcDetail.Attachment .
MethodsIntroduced:
Drawings 173
• pfcDetail.OffsetAttachment.GetAttachedGeometry
• pfcDetail.OffsetAttachment.SetAttachedGeometry
• pfcDetail.OffsetAttachment.GetAttachmentPoint
• pfcDetail.OffsetAttachment.SetAttachmentPoint
The method pfcDetail.OffsetAttachment.GetAttachedGeometry
returns the pfcSelect.Selection object representing the item to which the
detail attachment is attached. This includes the drawing view where the
attachment is made, if the offset reference is in a model.
The method pfcDetail.OffsetAttachment.SetAttachedGeometry
assigns the pfcSelect.Selection object representing the item to which the
detail attachment is attached. This can include the drawing view. The attachment
will occur at the selected parameters.
The method pfcDetail.OffsetAttachment.GetAttachmentPoint
returns the attachment point. This location is in screen coordinates for drawing
items, symbol instances and surface finishes on flat-to-screen annotation planes,
and in model coordinates for symbols and surface finishes on 3D model
annotation planes. The distance from the attachment point to the location of the
item to which the detail attachment is attached is saved as the offset distance.
The method pfcDetail.OffsetAttachment.SetAttachmentPoint
sets the attachment point in screen coordinates.
Unsupported Attachment
The ATTACH_TYPE_UNSUPPORTED detail attachment type is represented by
the pfcDetail.UnsupportedAttachment. It is a child of the
pfcDetail.Attachment .
Method Introduced:
• pfcDetail.UnsupportedAttachment.GetAttachmentPoint
• pfcDetail.UnsupportedAttachment.SetAttachmentPoint
The method
pfcDetail.UnsupportedAttachment.GetAttachmentPoint returns
the attachment point. This location is in screen coordinates for drawing items,
symbol instances and surface finishes on flat-to-screen annotation planes, and in
model coordinates for symbols and surface finishes on 3D model annotation
planes.
The method
pfcDetail.UnsupportedAttachment.SetAttachmentPoint
assigns the attachment point in screen coordinates.
Most of the objects and methods in J-Link are used with solid models (parts and
assemblies). Because solid objects inherit from the interface Model, you can use
any of the Model methods on any Solid, Part, or Assembly object.
175
Getting a Solid Object
Methods Introduced:
• pfcSession.BaseSession.CreatePart
• pfcSession.BaseSession.CreateAssembly
• pfcAssembly.ComponentPath.GetRoot
• pfcAssembly.ComponentPath.GetLeaf
• pfcMFG.MFG.GetSolid
The methods pfcSession.BaseSession.CreatePart and
pfcSession.BaseSession.CreateAssembly create new solid models
with the names you specify.
The methods pfcAssembly.ComponentPath.GetRoot and
pfcAssembly.ComponentPath.GetLeaf specify the solid objects that
make up the component path of an assembly component model. You can get a
component path object from any component that has been interactively selected.
The method pfcMFG.MFG.GetSolid retrieves the storage solid in which the
manufacturing model’s features are placed. In order to create a UDF group in the
manufacturing model, call the method pfcSolid.Solid.CreateUDFGroup
on the storage solid.
Solid Information
Methods Introduced:
• pfcSolid.Solid.GetRelativeAccuracy
• pfcSolid.Solid.SetRelativeAccuracy
• pfcSolid.Solid.GetAbsoluteAccuracy
• pfcSolid.Solid.SetAbsoluteAccuracy
You can set the relative and absolute accuracy of any solid model using these
methods. Relative accuracy is relative to the size of the solid. For example, a
relative accuracy of .01 specifies that the solid must be accurate to within 1/100 of
its size. Absolute accuracy is measured in absolute units (inches, centimeters, and
so on).
Note
For a change in accuracy to take effect, you must regenerate the model.
Note
Setting the configuration option to switch to Resolve mode ensures the old
behavior as long as you do not retrieve the models saved under the No-
Resolve mode. To consistently preserve the old behavior, use Resolve mode
from the beginning and throughout your PTC Creo Parametric session.
Solid 177
The pfcSolid.RegenInstructions object contains the following input
parameters:
• AllowFixUI—Determines whether or not to activate the Fix Model user
interface, if there is an error.
Use the method pfcSolid.RegenInstructions.SetAllowFixUI to
modify this parameter.
• ForceRegen—PTC Creo Parametric
Use the method pfcSolid.RegenInstructions.SetForceRegen to
modify this parameter.
• FromFeat—Not currently used. This parameter is reserved for future use.
Use the method pfcSolid.RegenInstructions.SetFromFeat to
modify this parameter.
• RefreshModelTree—PTC Creo Parametric Model Tree
Use the method
pfcSolid.RegenInstructions.SetRefreshModelTree to
modify this parameter.
• ResumeExcludedComponents—PTC Creo Parametric
Use the method
pfcSolid.RegenInstructions.SetResumeExcludedCompo
nents to modify this parameter.
• UpdateAssemblyOnly—Updates the placements of an assembly and all its sub-
assemblies, and regenerates the assembly features and intersected parts. If the
affected assembly is retrieved as a simplified representation, then the locations
of the components are updated. If this attribute is false, the component
locations are not updated, even if the simplified representation is retrieved. By
default, it is false.
Use the method
pfcSolid.RegenInstructions.SetUpdateAssemblyOnly to
modify this parameter.
• UpdateInstances—Updates the instances of the solid model in memory. This
may slow down the regeneration process. By default, this attribute is false.
Use the method
pfcSolid.RegenInstructions.SetUpdateInstances to modify
this parameter.
Solid Units
Each model has a basic system of units to ensure all material properties of that
model are consistently measured and defined. All models are defined on the basis
of the system of units. A part can have only one system of unit.
The following types of quantities govern the definition of units of measurement:
• Basic Quantities—The basic units and dimensions of the system of units. For
example, consider the Centimeter Gram Second (CGS) system of unit.
The basic quantities for this system of units are:
○ Length—cm
○ Mass—g
○ Force—dyne
○ Time—sec
○ Temperature—K
• Derived Quantities—The derived units are those that are derived from the
basic quantities. For example, consider the Centimeter Gram Second
(CGS) system of unit. The derived quantities for this system of unit are as
follows:
○ Area—cm^2
○ Volume—cm^3
○ Velocity—cm/sec
In J-Link, individual units in the model are represented by the interface
pfcUnits.Unit.
Solid 179
• Pre-defined system of units—This system of unit is provided by default.
• Custom-defined system of units—This system of unit is defined by the user
only if the model does not contain standard metric or nonmetric units, or if the
material file contains units that cannot be derived from the predefined system
of units or both.
In PTC Creo Parametric, the system of units are categorized as follows:
• Mass Length Time (MLT)—The following systems of units belong to this
category:
○ CGS—Centimeter Gram Second
○ MKS—Meter Kilogram Second
○ mmKS—millimeter Kilogram Second
• Force Length Time (FLT)—The following systems of units belong to this
category:
○ PTC Creo Parametric Default—Inch lbm Second. This is the default
system followed by PTC Creo Parametric.
○ FPS—Foot Pound Second
○ IPS—Inch Pound Second
○ mmNS—Millimeter Newton Second
In J-Link, the system of units followed by the model is represented by the
interface pfcUnits.UnitSystem.
Solid 181
Note
PTC Creo Parametric scales the length dimensions of the model using the
factors listed above. If the scale is modified, the model is regenerated.
When you scale the model, the model units are not changed. Imported
geometry cannot be scaled.
Note
You can delete only custom units and not standard units.
Solid 183
Modifying Systems of Units
Methods Introduced:
• pfcUnits.UnitSystem.Delete
• pfcUnits.UnitSystem.SetName
The method pfcUnits.UnitSystem.Delete deletes a custom-defined
system of units.
Note
You can delete only a custom-defined system of units and not a standard
system of units.
Mass Properties
Method Introduced:
• pfcSolid.Solid.GetMassProperty
The function pfcSolid.Solid.GetMassProperty provides information
about the distribution of mass in the part or assembly. It can provide the
information relative to a coordinate system datum, which you name, or the default
one if you provide null as the name. It returns a class called MassProperty.
The class contains the following fields:
• The volume.
• The surface area.
• The density. The density value is 1.0, unless a material has been assigned.
• The mass.
• The center of gravity (COG).
• The inertia matrix.
• The inertia tensor.
Solid 185
• The inertia about the COG.
• The principal moments of inertia (the eigen values of the COG inertia).
• The principal axes (the eigenvectors of the COG inertia).
Annotations
Methods Introduced:
• pfcNote.Note.GetLines
• pfcNote.Note.SetLines
• pfcNote.Note.GetText
• pfcNote.Note.GetURL
• pfcNote.Note.SetURL
• pfcNote.Note.Display
• pfcNote.Note.Delete
• pfcNote.Note.GetOwner
3D model notes are instance of ModelItem objects. They can be located and
accessed using methods that locate model items in solid models, and downcast to
the Note interface to use the methods in this section.
The method pfcNote.Note.GetLines returns the text contained in the 3D
model note. The method pfcNote.Note.SetLines modifies the note text.
The method pfcNote.Note.GetText returns the the text of the solid model
note. If you set the parameter GiveParametersAsNames to TRUE, then the text
displays the parameter callouts with ampersands (&). If you set the parameter to
FALSE, then the text displays the parameter values with no callout information.
The method pfcNote.Note.GetURL returns the URL stored in the 3D model
note. The method pfcNote.Note.SetURL modifies the note URL.
The method pfcNote.Note.Display forces the display of the model note.
The method pfcNote.Note.Delete deletes a model note.
The method pfcNote.Note.GetOwner returns the solid model owner of the
note.
Materials
J-Link enables you to programmatically access the material types and properties
of parts. Using the methods and properties described in the following sections,
you can perform the following actions:
• Create or delete materials
• Set the current material
• Access and modify the material types and properties
Methods Introduced:
Solid 187
• pfcPart.Material.Save
• pfcPart.Material.Delete
• pfcPart.Part.GetCurrentMaterial
• pfcPart.Part.SetCurrentMaterial
• pfcPart.Part.ListMaterials
• pfcPart.Part.CreateMaterial
• pfcPart.Part.RetrieveMaterial
The method pfcPart.Material.Save writes to a material file that can be
imported into any PTC Creo Parametric part.
The method pfcPart.Material.Delete removes material from the part.
The method pfcPart.Part.GetCurrentMaterial returns the currently
assigned material for the part.
The method pfcPart.Part.SetCurrentMaterial sets the material
assigned to the part.
Note
By default, while assigning a material to a sheetmetal part, the method
pfcPart.Part.SetCurrentMaterial modifies the values of the
sheetmetal properties such as Y factor and bend table according to the material
file definition. This modification triggers a regeneration and a modification of
the developed length calculations of the sheetmetal part. However, you can
avoid this behavior by setting the value of the configuration option
material_update_smt_bend_table to never_replace
The method pfcPart.Part.SetCurrentMaterial may change the
model display, if the new material has a default appearance assigned to it.
The method may also change the family table, if the parameter PTC_
MATERIAL_NAME is a part of the family table.
Solid 189
• MTL_ISOTROPIC—Specifies a material with an infinite number of planes of
material symmetry, making the properties equal in all directions.
• MTL_ORTHOTROPIC—Specifies a material with symmetry relative to three
mutually perpendicular planes.
• MTL_TRANSVERSELY_ISOTROPIC—Specifies a material with rotational
symmetry about an axis. The properties are equal for all directions in the plane
of isotropy.
Use the method pfcPart.Material.SetThermalMaterialType to set
the material type for the thermal properties of the material.
The method pfcPart.Material.GetSubType returns the subtype for the
MTL_ISOTROPIC material type.
Use the method pfcPart.Material.SetSubType to set the subtype for the
MTL_ISOTROPIC material type.
Use the method pfcPart.Material.GetPermittedSubTypes to retrieve
a list of the permitted string values for the material subtype.
Solid 191
The methods pfcPart.Material.GetFatigueType and
pfcPart.Material.SetFatigueType return and set the valid fatigue type
for the material respectively.
Use the method pfcPart.Material.GetPermittedFatigueTypes to
get a list of the permitted string values for the fatigue type.
The methods pfcPart.Material.GetFatigueMaterialType and
pfcPart.Material.SetFatigueMaterialType return and set the class
of material when determining the effect of the fatigue respectively.
Use the method
pfcPart.Material.GetPermittedFatigueMaterialTypes to
retrieve a list of the permitted string values for the fatigue material type.
The methods pfcPart.Material.GetFatigueMaterialFinish and
pfcPart.Material.SetFatigueMaterialFinish return and set the
type of surface finish for the fatigue material respectively.
Use the method
pfcPart.Material.GetPermittedFatigueMaterialFinishes to
retrieve a list of permitted string values for the fatigue material finish.
The method pfcPart.Material.GetFailureCriterion returnsthe
reduction factor for the failure strength of the material. This factor is used to
reduce the endurance limit of the material to account for unmodeled stress
concentrations, such as those found in welds. Use the method
pfcPart.Material.SetFailureCriterion to set the reduction factor
for the failure strength of the material.
Use the method pfcPart.Material.GetPermittedFailureCriteria
to retrieve a list of permitted string values for the material failure criterion.
The methods pfcPart.Material.GetHardness and
pfcPart.Material.SetHardness return and set the hardness for the
specified material respectively.
The methods pfcPart.Material.GetHardnessType and
pfcPart.Material.SetHardnessType return and set the hardness type
for the specified material respectively.
The methods pfcPart.Material.GetCondition and
pfcPart.Material.GetCondition return and set the condition for the
specified material respectively.
The methods pfcPart.Material.GetBendTable and
pfcPart.Material.SetBendTable return and set the bend table for the
specified material respectively.
The methods pfcPart.Material.GetCrossHatchFile and
pfcPart.Material.SetCrossHatchFile return and set the file
containing the crosshatch pattern for the specified material respectively.
Solid 193
13
Windows and Views
Windows................................................................................................................. 196
Embedded Browser ................................................................................................. 198
Views ..................................................................................................................... 199
Coordinate Systems and Transformations ................................................................. 200
J-Link provides access to PTC Creo Parametric windows and saved views. This
chapter describes the methods that provide this access.
195
Windows
This section describes the J-Link methods that access Window objects. The topics
are as follows:
• Getting a Window Object on page 196
• Window Operations on page 197
Note
You must call the method pfcModel.Model.Display for the model
geometry to be displayed in the window.
Window Operations
Methods Introduced:
• pfcWindow.Window.GetHeight
• pfcWindow.Window.GetWidth
• pfcWindow.Window.GetXPos
• pfcWindow.Window.GetYPos
• pfcWindow.Window.GetGraphicsAreaHeight
• pfcWindow.Window.GetGraphicsAreaWidth
• pfcWindow.Window.Clear
• pfcWindow.Window.Repaint
• pfcWindow.Window.Refresh
• pfcWindow.Window.Close
• pfcWindow.Window.Activate
• pfcWindow.Window.GetId
• pfcSession.BaseSession.FlushCurrentWindow
The methods pfcWindow.Window.GetHeight,
pfcWindow.Window.GetWidth, pfcWindow.Window.GetXPos, and
pfcWindow.Window.GetYPos retrieve the height, width, x-position, and y-
position of the window respectively. The values of these parameters are
normalized from 0 to 1.
The methods pfcWindow.Window.GetGraphicsAreaHeight and
pfcWindow.Window.GetGraphicsAreaWidth retrieve the height and
width of the PTC Creo Parametric graphics area window without the border
respectively. The values of these parameters are normalized from 0 to 1. For both
the window and graphics area sizes, if the object occupies the whole screen, the
window size returned is 1. For example, if the screen is 1024 pixels wide and
the graphics area is 512 pixels, then the width of the graphics area window is
returned as 0.5.
Note
It is recommended to call this method only after completing all the display
operations. Excessive use of this method will cause major slow down of
systems running on Windows Vista and Windows 7.
Embedded Browser
Methods Introduced:
• pfcWindow.Window.GetURL
• pfcWindow.Window.SetURL
• pfcWindow.Window.GetBrowserSize
• pfcWindow.Window.SetBrowserSize
The methods pfcWindow.Window.GetURL and
pfcWindow.Window.SetURL enables you to find and change the URL
displayed in the embedded browser in the PTC Creo Parametric window.
Note
The methods pfcWindow.Window.GetBrowserSize and
pfcWindow.Window.SetBrowserSize are not supported if the browser
is open in a separate window.
Views
This section describes the J-Link methods that access View objects. The topics
are as follows:
• Getting a View Object on page 199
• View Operations on page 200
Coordinate Systems
PTC Creo Parametric and J-Link use the following coordinate systems:
• Solid Coordinate System on page 201
• Screen Coordinate System on page 201
• Window Coordinate System on page 201
• Drawing Coordinate System on page 202
• Drawing View Coordinate System on page 202
• Assembly Coordinate System on page 202
• Datum Coordinate System on page 202
• Section Coordinate System on page 202
The following sections describe each of these coordinate systems.
Transformations
Methods Introduced:
• pfcBase.Transform3D.Invert
• pfcBase.Transform3D.TransformPoint
• pfcBase.Transform3D.TransformVector
The method viewTransfer accepts two views and transfers the matrix from
the first to the second. This matrix is normalized using the second method,
matrixNormalize.
Views can be changed to a normalized matrix only. The example method
UtilMatrixNormalize takes a Matrix3D object and normalizes it.
Note
Both of these methods are declared to throw the exception jxthrowable.
You need to put your error-handling code in the methods that call the utility
methods.
This chapter describes the J-Link methods that enable you to access and
manipulate ModelItems.
207
Solid Geometry Traversal
Solid models are made up of 11 distinct types of ModelItem, as follows:
• pfcFeature.Feature
• pfcGeometry.Surface
• pfcGeometry.Edge
• pfcGeometry.Curve (datum curve)
• pfcGeometry.Axis (datum axis)
• pfcGeometry.Point (datum point)
• pfcGeometry.Quilt (datum quilt)
• pfcLayer.Layer
• pfcNote.Note
• pfcDimension.Dimension
• pfcDimension.RefDimension
Each model item is assigned a unique identification number that will never
change. In addition, each model item can be assigned a string name. Layers,
points, axes, dimensions, and reference dimensions are automatically assigned a
name that can be changed.
ModelItem Information
Methods Introduced:
• pfcModelItem.ModelItem.GetName
• pfcModelItem.ModelItem.SetName
• pfcModelItem.ModelItem.GetId
• pfcModelItem.ModelItem.GetType
Certain ModelItems also have a string name that can be changed at any time.
The methods GetName and SetName access this name.
The method Id returns the unique integer identifier for the ModelItem.
The Type method returns an enumeration object that indicates the model item
type of the specified ModelItem. See the section Solid Geometry Traversal on
page 208 for the list of possible model item types.
ModelItem 209
Duplicating ModelItems
Methods Introduced:
• pfcSession.BaseSession.AllowDuplicateModelItems
You can control the creation of ModelItems more than twice for the same PTC
Creo Parametric item. The method
pfcSession.BaseSession.AllowDuplicateModelItems allows you
to turn ON or OFF the option to duplicate model items. By default, this option is
OFF. To turn the option ON, set the boolean value to FALSE.
Note
If this option is not handled properly on the application side, it can cause
memory corruption. Thus, althought you can turn ON and OFF this option as
many times as you want, PTC recommends turning ON and OFF this option
only once, right after the session is obtained.
Layer Objects
In J-Link, layers are instances of ModelItem. The following sections describe
how to get layer objects and the operations you can perform on them.
Layer Operations
Methods Introduced:
• pfcLayer.Layer.GetStatus
• pfcLayer.Layer.SetStatus
• pfcLayer.Layer.ListItems
• pfcLayer.Layer.AddItem
Note
You cannot add the following items to a layer:
• ITEM_SURFACE,
• ITEM_EDGE,
• ITEM_COORD_SYS,
• ITEM_AXIS,
• ITEM_SIMPREP,
• ITEM_DTL_SYM_DEFINITION,
• ITEM_DTL_OLE_OBJECT,
• ITEM_EXPLODED_STATE.
The method pfcLayer.Layer.Delete removes the layer (but not the items it
contains) from the model.
The method pfcLayer.Layer.CountUnsupportedItems returns the
number of item types not supported as a pfcModelItem object in the specified
layer. This method deprecates the method
pfcLayer::HasUnsupportedItems.
ModelItem 211
15
Features
Access to Features.................................................................................................. 214
Feature Information ................................................................................................. 214
Feature Operations ................................................................................................. 215
Feature Groups and Patterns ................................................................................... 218
User Defined Features............................................................................................. 220
Creating Features from UDFs................................................................................... 222
All PTC Creo Parametric solid models are made up of features. This chapter
describes how to program on the feature level using J-Link.
213
Access to Features
Methods Introduced:
• pfcFeature.Feature.ListChildren
• pfcFeature.Feature.ListParents
• pfcFeature.FeatureGroup.GetGroupLeader
• pfcFeature.FeaturePattern.GetPatternLeader
• pfcFeature.FeaturePattern.ListMembers
• pfcSolid.Solid.ListFailedFeatures
• pfcSolid.Solid.ListFeaturesByType
• pfcSolid.Solid.GetFeatureById
The methods pfcFeature.Feature.ListChildren and
pfcFeature.Feature.ListParents return a sequence of features that
contain all the children or parents of the specified feature.
To get the first feature in the specified group access the method
pfcFeature.FeatureGroup.GetGroupLeader.
The methods pfcFeature.FeaturePattern.GetPatternLeader and
the method pfcFeature.FeaturePattern.ListMembers return features
that make up the specified feature pattern. See the section Feature Groups and
Patterns on page 218 for more information on feature patterns.
The method pfcSolid.Solid.ListFailedFeatures returns a sequence
that contains all the features that failed regeneration.
The method pfcSolid.Solid.ListFeaturesByType returns a sequence
of features contained in the model. You can specify which type of feature to
collect by passing in one of the FeatureType enumeration objects, or you can
collect all features by passing void null as the type. If you list all features, the
resulting sequence will include invisible features that PTC Creo Parametric
creates internally. Internal features are invisible features used internally for
construction purposes. Use the method’s VisibleOnly argument to exclude them. If
the argument VisibleOnly is True, the function lists the public features only. If the
argument is False, the function lists both public and internal features.
The method pfcSolid.Solid.GetFeatureById returns the feature object
with the corresponding integer identifier.
Feature Information
Methods Introduced:
• pfcFeature.Feature.GetFeatType
• pfcFeature.Feature.GetStatus
Feature Operations
Methods Introduced:
Features 215
• pfcSolid.Solid.ExecuteFeatureOps
• pfcFeature.Feature.CreateSuppressOp
• pfcFeature.SuppressOperation.SetClip
• pfcFeature.SuppressOperation.SetAllowGroupMembers
• pfcFeature.SuppressOperation.SetAllowChildGroupMembers
• pfcFeature.Feature.CreateDeleteOp
• pfcFeature.DeleteOperation.SetClip
• pfcFeature.DeleteOperation.SetAllowGroupMembers
• pfcFeature.DeleteOperation.SetAllowChildGroupMembers
• pfcFeature.DeleteOperation.SetKeepEmbeddedDatums
• pfcFeature.Feature.CreateResumeOp
• pfcFeature.ResumeOperation.SetWithParents
• pfcFeature.Feature.CreateReorderBeforeOp
• pfcFeature.ReorderBeforeOperation.SetBeforeFeat
• pfcFeature.Feature.CreateReorderAfterOp
• pfcFeature.ReorderAfterOperation.SetAfterFeat
• pfcFeature.FeatureOperations.create
The method pfcSolid.Solid.ExecuteFeatureOps causes a sequence of
feature operations to run in order. Feature operations include suppressing,
resuming, reordering, and deleting features. The optional
RegenInstructions argument specifies whether the user will be allowed to
fix the model if a regeneration failure occurs.
Note
The method pfcSolid.Solid.ExecuteFeatureOps is not supported
in the No-Resolve mode, introduced in Pro/ENGINEER Wildfire 5.0. It throws
an exception pfcExceptions.XToolkitBadContext. To continue
with the Pro/ENGINEER Wildfire 4.0 behavior in the Resolve mode, set the
configuration option regen_failure_handling to resolve_mode in
the PTC Creo Parametric session. Refer to the Solid Operations on page 177
section in the Solid on page 175 chapter for more information on the No-
Resolve mode.
You can create an operation that will delete, suppress, reorder, or resume certain
features using the methods in the interface pfcFeature.Feature. Each
created operation must be passed as a member of the FeatureOperations
Features 217
• BeforeFeat—Specifies the feature before which you want to reorder the
features.
Use the method
pfcFeature.ReorderBeforeOperation.SetBeforeFeat to
modify this option.
• AfterFeat—Specifies the feature after which you want to reorder the
features.
Use the method
pfcFeature.ReorderAfterOperation.SetAfterFeat to modify
this option.
Note
The pattern header feature is not treated as a leader or a member of the pattern
by the methods described in the following section.
Methods Introduced:
• pfcFeature.Feature.GetGroup
• pfcFeature.Feature.GetPattern
• pfcSolid.Solid.CreateLocalGroup
• pfcFeature.FeatureGroup.GetPattern
• pfcFeature.FeatureGroup.GetGroupLeader
• pfcFeature.FeaturePattern.GetPatternLeader
• pfcFeature.FeaturePattern.ListMembers
• pfcFeature.FeaturePattern.Delete
The method pfcFeature.Feature.GetGroup returns a handle to the local
group that contains the specified feature.
Features 219
The method pfcFeature.FeaturePattern.ListMembers returns the
pattern header features with following IDs for a pattern of pattern:
• 119
• 177
• 221
• 265
The methods pfcFeature.Feature.GetPattern and
pfcFeature.FeatureGroup.GetPattern return the
FeaturePattern object that contains the corresponding Feature or
FeatureGroup. Use the method pfcSolid.Solid.CreateLocalGroup
to take a sequence of features and create a local group with the specified name. To
delete a FeaturePattern object, call the method
pfcFeature.FeaturePattern.Delete.
Note
All methods in this section can be used for UDFs and local groups.
Features 221
The method pfcUDFGroup.UDFDimension.GetUDFDimensionName
provides access to the dimension name specified when the UDF was created, and
not the name of the dimension in the current model. This name is required to place
the UDF programmatically using the method
pfcSolid.Solid.CreateUDFGroup.
Creating UDFs
Creating a UDF requires the following information:
Features 223
Creating a Custom UDF
Method Introduced:
• pfcUDFCreate.pfcUDFCreate.UDFCustomCreateInstructions_Create
This method creates a UDFCustomCreateInstructions object with a
specified name. To set the UDF creation parameters programmatically you must
modify this object as described below. The members of this class relate closely to
the prompts PTC Creo Parametric gives you when you create a UDF interactively.
PTC recommends that you experiment with creating the UDF interactively using
PTC Creo Parametric before you write the J-Link code to fill the structure.
Note
UDFDEP_INDEPENDENT is the default value, if this option is not set.
Note
The default value is UDFSCALE_SAME_SIZE if this option is not set.
Note
The default value is UDFDISPLAY_NORMAL if this option is not set.
Features 225
Setting the Variable Dimensions and Parameters
Methods Introduced:
• pfcUDFCreate.UDFCustomCreateInstructions.SetVariantValues
• pfcUDFCreate.UDFVariantValues.create
• pfcUDFCreate.UDFVariantValues.insert
• pfcUDFCreate.pfcUDFCreate.UDFVariantDimension_Create
• pfcUDFCreate.pfcUDFCreate.UDFVariantPatternParam_Create
pfcUDFVariantValues class represents an array of variable dimensions and
pattern parameters.
Use pfcUDFCreate.UDFVariantValues.create to create an empty
object and then use pfcUDFCreate.UDFVariantValues.insert to add
pfcUDFCreate.UDFVariantPatternParam or
pfcUDFCreate.UDFVariantDimension objects one by one.
pfcUDFCreate.pfcUDFCreate.UDFVariantDimension_Create is a
static method creating a pfcUDFCreate.UDFVariantDimension. It
accepts the following parameters:
• Name—The symbol that the dimension had when the UDF was originally
defined not the prompt that the UDF uses when it is created interactively. To
make this name easy to remember, before you define the UDF that you plan to
create with the J-Link, you should modify the symbols of all the dimensions
that you want to select to be variable. If you get the name wrong,
pfcSolid.Solid.CreateUDFGroup will not recognize the dimension
and prompts the user for the value in the usual way does not modify the value.
• DimensionValue—The new value.
If you do not remember the name, you can find it by creating the UDF
interactively in a test model, then using the
pfcFeature.FeatureGroup.ListUDFDimensions and
pfcUDFGroup.UDFDimension.GetUDFDimensionName to find out the
name.
pfcUDFCreate.pfcUDFCreate.UDFVariantPatternParam_Create
is a static method which creates a
pfcUDFCreate.UDFVariantPatternParam. It accepts the following
parameters:
• name—The string name that the pattern parameter had when the UDF was
originally defined
• —The new value.
Features 227
After the UDFReferences object has been set, use
pfcUDFCreate.UDFCustomCreateInstructions.SetReferences
to add the program-defined references.
Setting Quadrants
Methods Introduced:
• pfcUDFCreate.UDFCustomCreateInstructions.SetQuadrants
The method
pfcUDFCreate.UDFCustomCreateInstructions.SetQuadrants
sets an array of points, which provide the X, Y, and Z coordinates that correspond
to the picks answering the PTC Creo Parametric prompts for the feature positions.
The order of quadrants should correspond to the order in which PTC Creo
Parametric prompts for them when the UDF is created interactively.
Features 229
• pfcUDFCreate.UDFCustomCreateInstructions.SetExtReferences
The method
pfcUDFCreate.UDFCustomCreateInstructions.SetExtReferenc
es sets an external reference assembly to be used when placing the UDF. This
will be required when placing the UDF in the component using references outside
of that component. References could be to the top level assembly of another
component.
Example Code 1
The sample code in the file pfcUDFCreateExamples.java located at
<creo_jlink_loadpoint>/jlink_appls/jlinkexamples copies of
a node UDF at a particular coordinate system location in a part. The node UDF is
a spherical cut centered at the coordinate system whose diameter is driven by the
'diam' argument to the method. The method returns the FeatureGroup object
created, or null if an error occurred..
This chapter describes the J-Link methods that provide read access to the
properties of datum features.
231
Datum Plane Features
The properties of the Datum Plane feature are defined in the
pfcDatumPlaneFeat.DatumPlaneFeatdata object.
Methods Introduced:
• pfcDatumPlaneFeat.DatumPlaneFeat.GetFlip
• pfcDatumPlaneFeat.DatumPlaneFeat.GetConstraints
• pfcDatumPlaneFeat.DatumPlaneConstraint.GetConstraintType
• pfcDatumPlaneFeat.DatumPlaneThroughConstraint.GetThroughRef
• pfcDatumPlaneFeat.DatumPlaneNormalConstraint.GetNormalRef
• pfcDatumPlaneFeat.DatumPlaneParallelConstraint.GetParallelRef
• pfcDatumPlaneFeat.DatumPlaneTangentConstraint.GetTangentRef
• pfcDatumPlaneFeat.DatumPlaneOffsetConstraint.GetOffsetRef
• pfcDatumPlaneFeat.DatumPlaneOffsetConstraint.GetOffsetValue
• pfcDatumPlaneFeat.DatumPlaneOffsetCoordSysConstraint.GetCsysAxis
• pfcDatumPlaneFeat.DatumPlaneAngleConstraint.GetAngleRef
• pfcDatumPlaneFeat.DatumPlaneAngleConstraint.GetAngleValue
• pfcDatumPlaneFeat.DatumPlaneSectionConstraint.GetSectionRef
• pfcDatumPlaneFeat.DatumPlaneSectionConstraint.GetSectionIndex
The properties of the pfcDatumPlaneFeat.DatumPlaneFeat object are
described as follows:
• Flip—Specifies whether the datum plane was flipped during creation. Use
the method pfcDatumPlaneFeat.DatumPlaneFeat.GetFlip to
determine if the datum plane was flipped during creation.
• Constraints—Specifies a collection of constraints given by the
pfcDatumPlaneFeat.DatumPlaneConstraint object. The method
pfcDatumPlaneFeat.DatumPlaneFeat.GetConstraints obtains
the collection of constraints defined for the datum plane.
Use the method
pfcDatumPlaneFeat.DatumPlaneConstraint.GetConstraint
Type to obtain the type of constraint. The type of constraint is given by the
pfcDatumPlaneFeat.DatumPlaneConstraintType enumerated type.
The available types are as follows:
• DTMPLN_THRU—Specifies the Through constraint. The
pfcDatumPlaneFeat DatumPlaneThroughConstraint object
specifies this constraint. Use the method
pfcDatumPlaneFeat.DatumPlaneThroughConstraint.
241
Geometry Traversal
• A simple rectangular face has one contour and four edges.
• A contour will traverse a boundary so that the part face is always on the right-
hand side (RHS). For an external contour the direction of traversal is
clockwise. For an internal contour the direction of traversal is
counterclockwise.
• If a part is extruded from a sketch that has a U-shaped cross section there will
be separate surfaces at each leg of the U-channel.
• If a part is extruded from a sketch that has a square-shaped cross section, and a
slot feature is then cut into the part to make it look like a U-channel, there will
be one surface across the legs of the U-channel. The original surface of the
part is represented as one surface with a cut through it.
Geometry Terms
Following are definitions for some geometric terms:
• Surface—An ideal geometric representation, that is, an infinite plane.
• Face—A trimmed surface. A face has one or more contours.
• Contour—A closed loop on a face. A contour consists of multiple edges. A
contour can belong to one face only.
• Edge—The boundary of a trimmed surface.
An edge of a solid is the intersection of two surfaces. The edge belongs to those
two surfaces and to two contours. An edge of a datum surface can be either the
intersection of two datum surfaces or the external boundary of the surface.
If the edge is the intersection of two datum surfaces it will belong to those two
surfaces and to two contours. If the edge is the external boundary of the datum
surface it will belong to that surface alone and to a single contour.
The t Parameter
The geometry of each edge or curve is represented as a set of three parametric
equations that represent the values of x, y, and z as functions of an independent
parameter, t. The t parameter varies from 0.0 at the start of the curve to 1.0 at the
end of it.
The following figure illustrates curve and edge parameterization.
Note
The methods in the interface Edge provide information only for solid or
surface edges.
Curve Descriptors
A curve descriptor is a data object that describes the geometry of a curve or edge.
A curve descriptor describes the geometry of a curve without being a part of a
specific model.
Methods Introduced:
Note
To get geometric information for an edge, access the
CurveDescriptor object for one edge using
pfcGeometry.GeomCurve.GetCurveDescriptor.
Contours
Methods Introduced:
• pfcGeometry.Surface.ListContours
• pfcGeometry.Contour.GetInternalTraversal
• pfcGeometry.Contour.FindContainingContour
• pfcGeometry.Contour.EvalArea
• pfcGeometry.Contour.EvalOutline
• pfcGeometry.Contour.VerifyUV
Contours are a series of edges that completely bound a surface. A contour is not a
ModelItem. You cannot get contours using the methods that get different types
of ModelItem. Use the method pfcGeometry.Surface.ListContours
to get contours from their containing surfaces.
The method pfcGeometry.Contour.GetInternalTraversal returns a
ContourTraversal enumerated type that identifies whether a given contour is
on the outside or inside of a containing surface.
Use the method pfcGeometry.Contour.FindContainingContour to
find the contour that entirely encloses the specified contour.
The method pfcGeometry.Contour.EvalArea provides the area enclosed
by the contour.
The method pfcGeometry.Contour.EvalOutline returns the points that
make up the bounding rectangle of the contour.
Surfaces
Using J-Link you access datum and solid surfaces in the same way.
UV Parameterization
A surface in PTC Creo Parametric is described as a series of parametric equations
where two parameters, u and v, determine the x, y, and z coordinates. Unlike the
edge parameter, t, these parameters need not start at 0.0, nor are they limited to
1.0.
The figure on the following page illustrates surface parameterization.
Surface Types
Surfaces within PTC Creo Parametric can be any of the following types:
Note
This is used only for datum surfaces.
Surface Information
Methods Introduced:
• pfcGeometry.Surface.GetSurfaceType
• pfcGeometry.Surface.GetXYZExtents
• pfcGeometry.Surface.GetUVExtents
• pfcGeometry.Surface.GetOrientation
Evaluation of Surfaces
Surface methods allow you to use multiple surface information to calculate,
evaluate, determine, and examine surface functions and problems.
Methods Introduced:
• pfcGeometry.Surface.GetOwnerQuilt
• pfcGeometry.Surface.EvalClosestPoint
• pfcGeometry.Surface.EvalClosestPointOnSurface
• pfcGeometry.Surface.Eval3DData
• pfcGeometry.Surface.EvalParameters
• pfcGeometry.Surface.EvalArea
• pfcGeometry.Surface.EvalDiameter
• pfcGeometry.Surface.EvalPrincipalCurv
• pfcGeometry.Surface.VerifyUV
• pfcGeometry.Surface.EvalMaximum
• pfcGeometry.Surface.EvalMinimum
• pfcGeometry.Surface.ListSameSurfaces
The method pfcGeometry.Surface.GetOwnerQuilt returns the Quilt
object that contains the datum surface.
The method pfcGeometry.Surface.EvalClosestPoint projects a
three-dimensional point onto the surface. Use the method
pfcGeometry.Surface.EvalClosestPointOnSurface to determine
whether the specified three-dimensional point is on the surface, within the
accuracy of the part. If it is, the method returns the point that is exactly on the
surface. Otherwise the method returns null.
Surface Descriptors
A surface descriptor is a data object that describes the shape and geometry of a
specified surface. A surface descriptor allows you to describe a surface in 3D
without an owner ID.
Methods Introduced:
• pfcGeometry.Surface.GetSurfaceDescriptor
• pfcGeometry.Surface.GetNURBSRepresentation
The method pfcGeometry.Surface.GetSurfaceDescriptor returns a
surfaces geometry as a data object.
The method pfcGeometry.Surface.GetNURBSRepresentation
returns a Non-Uniform Rational B-Spline Representation of a surface.
Interference
PTC Creo Parametric assemblies can contain interferences between components
when constraint by certain rules defined by the user. The
com.ptc.pfc.pfcInterference packageallows the user to detect and
analyze any interferences within the assembly. The analysis of this functionality
should be looked at from two standpoints: global and selection based analysis.
Methods Introduced:
• pfcInterference.pfcInterference.CreateGlobalEvaluator
• pfcInterference.GlobalEvaluator.ComputeGlobalInterference
• pfcInterference.GlobalEvaluator.GetAssem
• pfcInterference.GlobalEvaluator.SetAssem
• pfcInterference.GlobalInterference.GetVolume
• pfcInterference.GlobalInterference.GetSelParts
To compute all the interferences within an Assembly one has to call
pfcInterference.pfcInterference.CreateGlobalEvaluator
with a Assembly.Assembly object as an argument. This call returns
apfcGlobalEvaluator object. The GlobalEvaluator can be used to
extract an assembly object or to set an assembly object for the interference
computation.
The methods pfcInterference.GlobalEvaluator.GetAssem and
pfcInterference.GlobalEvaluator.SetAssem with
pfcAssembly.Assembly as an argument allow you to do exactly that.
Example Code
The sample code in the file UsrInterference.java located at <creo_
jlink_loadpoint>/jlink_appls/jlinkexamples finds the
interference in an assembly, highlights the interfering surfaces, and highlights
calculates the interference volume.
This application finds the interference in an assembly, highlights the interfering
surfaces, and highlights calculates the interference volume.
This chapter describes the J-Link methods and classes that affect dimensions and
parameters.
255
Overview
Dimensions and parameters in PTC Creo Parametric have similar characteristics
but also have significant differences. In J-Link, the similarities between
dimensions and parameters are contained in the ModelItem.BaseParameter
interface. This interface allows access to the parameter or dimension value and to
information regarding a parameter's designation and modification. The differences
between parameters and dimensions are recognizable because Dimension
inherits from the interface ModelItem, and can be assigned tolerances, whereas
parameters are not ModelItems and cannot have tolerances.
Parameter Objects
The following sections describe the J-Link methods that access parameters. The
topics are as follows:
• Creating and Accessing Parameters on page 257
• Parameter Selection Options on page 258
• Parameter Information on page 260
• Parameter Restrictions on page 262
Parameter Information
Methods Introduced:
• pfcModelItem.BaseParameter.GetValue
• pfcModelItem.BaseParameter.SetValue
• pfcModelItem.Parameter.GetScaledValue
• pfcModelItem.Parameter.SetScaledValue
• pfcModelItem.Parameter.GetUnits
• pfcModelItem.BaseParameter.GetIsDesignated
• pfcModelItem.BaseParameter.SetIsDesignated
• pfcModelItem.BaseParameter.GetIsModified
• pfcModelItem.BaseParameter.ResetFromBackup
• pfcModelItem.Parameter.GetDescription
• pfcModelItem.Parameter.SetDescription
• pfcModelItem.Parameter.GetRestriction
• pfcModelItem.Parameter.GetDriverType
• pfcModelItem.Parameter.Reorder
• pfcModelItem.Parameter.Delete
• pfcModelItem.NamedModelItem.GetName
Parameters inherit methods from the BaseParameter, Parameter and
NamedModelItem .
Parameter Restrictions
PTC Creo Parametric allows users to assign specified limitations to the value
allowed for a given parameter (wherever the parameter appears in the model). You
can only read the details of the permitted restrictions from J-Link, but not modify
the permitted values or range of values. Parameter restrictions in J-Link are
represented by the interface ModelItem.ParameterRestriction.
Method Introduced:
• pfcModelItem.ParameterRestriction.GetType
The method pfcModelItem.ParameterRestriction.GetType returns
the ModelItem.RestrictionType object containing the types of parameter
restrictions. The parameter restrictions are of the following types:
• PARAMSELECT_ENUMERATION—Specifies that the parameter is restricted
to a list of permitted values.
• PARAMSELECT_RANGE—Specifies that the parameter is limited to a
specified range of numeric values.
Enumeration Restriction
The PARAMSELECT_ENUMERATION type of parameter restriction is represented
by the ModelItem.ParameterEnumeration. It is a child of the
ModelItem.ParameterRestriction .
Method Introduced:
• pfcModelItem.ParameterEnumeration.GetPermittedValues
The method
pfcModelItem.ParameterEnumeration.GetPermittedValues
returns a list of permitted parameter values allowed by this restriction in the form
of a sequence of the ModelItem.ParamValue objects.
Getting Dimensions
Dimensions and reference dimensions are PTC Creo Parametric model items. See
the section Getting ModelItem Objects on page 208 for methods that can return
Dimension and RefDimension objects.
Dimension Information
Methods Introduced:
• pfcModelItem.BaseParameter.GetValue
• pfcModelItem.BaseParameter.SetValue
• pfcModelItem.BaseDimension.GetDimValue
• pfcModelItem.BaseDimension.SetDimValue
• pfcModelItem.BaseParameter.GetIsDesignated
• pfcModelItem.BaseParameter.SetIsDesignated
• pfcModelItem.BaseParameter.GetIsModified
• pfcModelItem.BaseParameter.ResetFromBackup
• pfcModelItem.BaseParameter.GetIsRelationDriven
• pfcDimension.BaseDimension.GetDimType
• pfcDimension.BaseDimension.GetSymbol
• pfcDimension.BaseDimension.GetTexts
• pfcDimension.BaseDimension.SetTexts
All the BaseParameter methods are accessible to Dimensions as well as
Parameters. See the section Parameter Objects on page 257 for brief descriptions.
Note
You cannot set the value or designation status of reference dimension objects.
Dimension Tolerances
Methods Introduced:
• pfcDimension.Dimension.GetTolerance
• pfcDimension.Dimension.SetTolerance
• pfcDimension.pfcDimension.DimTolPlusMinus_Create
• pfcDimension.pfcDimension.DimTolSymmetric_Create
• pfcDimension.pfcDimension.DimTolLimits_Create
• pfcDimension.pfcDimension.DimTolSymSuperscript_Create
• pfcDimension.pfcDimension.DimTolISODIN_Create
Only true dimension objects can have geometric tolerances.
The methods pfcDimension.Dimension.GetTolerance and
pfcDimension.Dimension.SetTolerance enable you to access the
dimension tolerance. The object types for the dimension tolerance are:
• DimTolLimits—Displays dimension tolerances as upper and lower limits.
Note
This format is not available when only the tolerance value for a dimension
is displayed.
This chapter describes how to access relations on all models and model items in
PTC Creo Parametric using the methods provided in J-Link.
267
Accessing Relations
In J-Link, the set of relations on any model or model item is represented by the
pfcModelItem.RelationOwner . Models, features, surfaces, and edges
inherit from this interface, because each object can be assigned relations in PTC
Creo Parametric.
Methods Introduced:
• pfcModelItem.RelationOwner.RegenerateRelations
• pfcModelItem.RelationOwner.DeleteRelations
• pfcModelItem.RelationOwner.GetRelations
• pfcModelItem.RelationOwner.SetRelations
• pfcModelItem.RelationOwner.EvaluateExpression
The method pfcModelItem.RelationOwner.RegenerateRelations
regenerates the relations assigned to the owner item. It also determines whether
the specified relation set is valid.
The method pfcModelItem.RelationOwner.DeleteRelations
deletes all the relations assigned to the owner item.
The method pfcModelItem.RelationOwner.GetRelations returns the
list of initial relations assigned to the owner item as a sequence of strings.
The method pfcModelItem.RelationOwner.SetRelations assigns the
sequence of strings as the new relations to the owner item.
The method pfcModelItem.RelationOwner.EvaluateExpression
evaluates the given relations-based expression, and returns the resulting value in
the form of the pfcModelItem.ParamValue object. Refer to the section The
ParamValue Object on page 256 in the chapter Dimensions and Parameters on
page 255 for more information on this object.
Note
To work with post-regeneration relations, use the post-regeneration relations
attribute in the methods
pfcModelItem.RelationOwner.SetRelations,
pfcModelItem.RelationOwner.RegenerateRelations and
pfcModelItem.RelationOwner.DeleteRelations.
You can regenerate the relation sets post-regeneration in a model using the method
fcModel.Model.RegeneratePostRegenerationRelations.
To delete all the post-regeneration relations in the specified model, call the method
pfcModel.Model.DeletePostRegenerationRelations.
Relations 269
20
Assemblies and Components
Structure of Assemblies and Assembly Objects ......................................................... 272
Assembling Components ......................................................................................... 277
Redefining and Rerouting Assembly Components ..................................................... 281
Exploded Assemblies .............................................................................................. 282
Skeleton Models...................................................................................................... 283
This chapter describes the J-Link functions that access the functions of a PTC
Creo Parametric assembly. You must be familiar with the following before you
read this section:
• The Selection Object
• Coordinate Systems
• The Geometry section
271
Structure of Assemblies and Assembly
Objects
The object Assembly is an instance of Solid. The Assembly object can
therefore be used as input to any of the Solid and Model methods applicable to
assemblies. However assemblies do not contain solid geometry items. The only
geometry in the assembly is datums (points, planes, axes, coordinate systems,
curves, and surfaces). Therefore solid assembly features such as holes and slots
will not contain active surfaces or edges in the assembly model.
The solid geometry of an assembly is contained in its components. A component
is a feature of type pfcComponentFeat.ComponentFeat, which is a
reference to a part or another assembly, and a set of parametric constraints for
determining its geometrical location within the parent assembly.
Assembly features that are solid, such as holes and slots, and therefore affect the
solid geometry of parts in the assembly hierarchy, do not themselves contain the
geometry items that describe those modifications. These items are always
contained in the parts whose geometry is modified, within local features created
for that purpose.
The important J-Link functions for assemblies are those that operate on the
components of an assembly. The object ComponentFeat, which is an instance
of Feature is defined for that purpose. Each assembly component is treated as a
variety of feature, and the integer identifier of the component is also the feature
identifier.
An assembly can contain a hierarchy of assemblies and parts at many levels, in
which some assemblies and parts may appear more than once. To identify the role
of any database item in the context of the root assembly, it is not sufficient to have
the integer identifier of the item and the handle to its owning part or assembly, as
would be provided by its Feature description.
It is also necessary to give the full path of the assembly-component references
down from the root assembly to the part or assembly that owns the database item.
This is the purpose of the object ComponentPath, which is used as the input to
J-Link assembly functions.
The following figure shows an assembly hierarchy with two examples of the
contents of a ComponentPath object.
Assembly Components
Methods Introduced:
• pfcComponentFeat.ComponentFeat.GetIsBulkitem
• pfcComponentFeat.ComponentFeat.GetIsSubstitute
• pfcComponentFeat.ComponentFeat.GetCompType
• pfcComponentFeat.ComponentFeat.SetCompType
Note
From Pro/ENGINEER Wildfire 4.0 onwards, the method
pfcComponentFeat.ComponentFeat.GetModelDescr throws an
exception pfcExceptions.XtoolkitCantOpen if called on an
assembly component whose immediate generic is not in session. Handle this
exception and typecast the assembly component as pfcSolid.Solid,
which in turn can be typecast as pfcFamily.FamilyMember, and use the
method pfcFamily.FamilyMember.GetImmediateGenericInfo
to get the model descriptor of the immediate generic model. If you wish to
switch off this behavior and continue to run legacy applications in the pre-
Wildfire 4.0 mode, set the configuration option retrieve_instance_
dependencies to instance_and_generic_deps.
Note
Once a component is constrained or packaged, it cannot be made unplaced
again.
Assembling Components
Methods Introduced:
• pfcAssembly.Assembly.AssembleComponent
• pfcAssembly.Assembly.AssembleByCopy
• pfcComponentFeat.ComponentFeat.GetConstraints
• pfcComponentFeat.ComponentFeat.SetConstraints
The method pfcAssembly.Assembly.AssembleComponent adds a
specified component model to the assembly at the specified initial position. The
position is specified in the format defined by the
interfacepfcBase.Transform3D. Specify the orientation of the three axes and
the position of the origin of the component coordinate system, with respect to the
target assembly coordinate system.
The method pfcAssembly.Assembly.AssembleByCopy creates a new
component in the specified assembly by copying from the specified component. If
no model is specified, then the new component is created empty. The input
parameters for this method are:
• LeaveUnplaced—If true the component is unplaced. If false the component is
placed at a default location in the assembly. Unplaced components belong to
an assembly without being assembled or packaged. These components appear
in the model tree, but not in the graphic window. Unplaced components can be
Constraint Attributes
Methods Introduced:
• pfcComponentFeat.pfcComponentFeat.ConstraintAttributes_Create
• pfcComponentFeat.ConstraintAttributes.GetForce
• pfcComponentFeat.ConstraintAttributes.SetForce
• pfcComponentFeat.ConstraintAttributes.GetIgnore
• pfcComponentFeat.ConstraintAttributes.SetIgnore
The method
pfcComponentFeat.pfcComponentFeat.ConstraintAttributes_
Create returns the constraint attributes object based on the values of the
following input parameters:
• Ignore—Constraint is ignored during regeneration. Use this capability to store
extra constraints on the component, which allows you to quickly toggle
between different constraints.
• Force—Constraint has to be forced for line and point alignment.
• None—No constraint attributes. This is the default value.
Exploded Assemblies
These methods enable you to determine and change the explode status of the
assembly object.
Methods Introduced:
• pfcAssembly.Assembly.GetIsExploded
• pfcAssembly.Assembly.Explode
• pfcAssembly.Assembly.UnExplode
• pfcAssembly.Assembly.GetActiveExplodedState
• pfcAssembly.Assembly.GetDefaultExplodedState
• pfcAssembly.ExplodedState.Activate
The methods pfcAssembly.Assembly.Explode and
pfcAssembly.Assembly.UnExplode enable you to determine and change
the explode status of the assembly object.
The method pfcAssembly.Assembly.GetIsExploded reports whether
the specified assembly is currently exploded. Use this method in the assembly
mode only. The exploded status of an assembly depends on the mode. If an
assembly is opened in the drawing mode, the state of the assembly in the drawing
view is displayed. The drawing view does not represent the actual exploded state
of the assembly.
The method pfcAssembly.Assembly.GetActiveExplodedState
returns the current active explode state.
The method pfcAssembly.Assembly.GetDefaultExplodedState
returns the default explode state.
Skeleton Models
Skeleton models are a 3-dimensional layout of the assembly. These models are
holders or distributors of critical design information, and can represent space
requirements, important mounting locations, and motion.
Methods Introduced:
• pfcAssembly.Assembly.AssembleSkeleton
• pfcAssembly.Assembly.AssembleSkeletonByCopy
• pfcAssembly.Assembly.GetSkeleton
• pfcAssembly.Assembly.DeleteSkeleton
• pfcSolid.Solid.GetIsSkeleton
The method pfcAssembly.Assembly.AssembleSkeleton adds an
existing skeleton model to the specified assembly.
The method pfcAssembly.Assembly.GetSkeleton returns the skeleton
model of the specified assembly.
The method pfcAssembly.Assembly.DeleteSkeleton deletes a
skeleton model component from the specified assembly.
The method pfcAssembly.Assembly.AssembleSkeletonByCopy adds
a specified skeleton model to the assembly. The input parameters for this method
are:
• SkeletonToCopy—Specify the skeleton model to be copied into the assembly
• NewSkeletonName—Specify a name for the copied skeleton model
The method pfcSolid.Solid.GetIsSkeleton determines if the specified
part model is a skeleton model or a concept model. It returns a true if the model is
a skeleton else it returns a false.
This chapter describes how to use J-Link classes and methods to access and
manipulate family table information.
285
Working with Family Tables
J-Link provides several methods for accessing family table information. Because
every model inherits from the pfcFamily.FamilyMember, every model can
have a family table associated with it.
Accessing Instances
Methods Introduced:
• pfcFamily.FamilyMember.GetParent
• pfcFamily.FamilyMember.GetImmediateGenericInfo
• pfcFamily.FamilyMember.GetTopGenericInfo
• pfcFamily.FamilyTableRow.CreateInstance
• pfcFamily.FamilyMember.ListRows
• pfcFamily.FamilyMember.GetRow
• pfcFamily.FamilyMember.RemoveRow
• pfcFamily.FamilyTableRow.GetInstanceName
• pfcFamily.FamilyTableRow.GetIsLocked
• pfcFamily.FamilyTableRow.SetIsLocked
To get the generic model for an instance, call the method
pfcFamily.FamilyMember.GetParent.
From Pro/ENGINEER Wildfire 4.0 onwards, the behavior of the method
pfcFamily.FamilyMember.GetParent has changed as a result of
performance improvement in family table retrieval mechanism. When you now
call the method pfcFamily.FamilyMember.GetParent, it throws an
exception pfcExceptions.XToolkitCantOpen, if the immediate generic
of a model instance in a nested family table is currently not in session. Handle this
exception and use the method
pfcFamily.FamilyMember.GetImmediateGenericInfo to get the
model descriptor of the immediate generic model. This information can be used to
retrieve the immediate generic model.
If you wish to switch off the above behavior and continue to run legacy
applications in the pre-Wildfire 4.0 mode, set the configuration option
retrieve_instance_dependencies to instance_and_generic_
deps.
To get the model descriptor of the top generic model, call the method
pfcFamily.FamilyMember.GetTopGenericInfo.
Similarly, the method pfcFamily.FamilyTableRow.CreateInstance
returns an instance model created from the information stored in the
FamilyTableRow object.
Accessing Columns
Methods Introduced:
• pfcFamily.FamilyMember.ListColumns
• pfcFamily.FamilyMember.GetColumn
• pfcFamily.FamilyMember.RemoveColumn
• pfcFamily.FamilyTableColumn.GetSymbol
• pfcFamily.FamilyTableColumn.GetType
• pfcFamily.FamColModelItem.GetRefItem
• pfcFamily.FamColParam.GetRefParam
The method pfcFamily.FamilyMember.ListColumns returns a sequence
of all columns in the family table.
The method pfcFamily.FamilyMember.GetColumn returns a family table
column, given its symbolic name.
To permanently delete the column from the family table and all changed values in
all instances, call the method pfcFamily.FamilyMember.RemoveColumn.
The method pfcFamily.FamilyTableColumn.GetSymbol returns the
string symbol at the top of the column, such as D4 or F5.
The method pfcFamily.FamilyTableColumn.GetType returns an
enumerated value indicating the type of parameter governed by the column in the
family table.
The method pfcFamily.FamColModelItem.GetRefItem returns the
ModelItem (Feature or Dimension) controlled by the column, whereas
pfcFamily.FamColParam.GetRefParam returns the Parameter
controlled by the column.
This chapter describes the J-Link methods that enable you to use action listeners.
291
J-Link Action Listeners
An ActionListener in Java is a class that is assigned to respond to certain
events. In J-Link, you can assign action listeners to respond to events involving
the following tasks:
• Changing windows
• Changing working directories
• Model operations
• Regenerating
• Creating, deleting, and redefining features
• Checking for regeneration failures
All action listeners in J-Link are defined by these classes:
• Interface—Named <Object>ActionListener. This interface defines the
methods that can respond to various events.
• Default class—Named Default<Object>ActionListener. This class has every
available method overridden by an empty implementation. You create your
own action listeners by extending the default class and overriding the methods
for events that interest you.
Note
When notifications are set in J-Link applications, every time an event is
triggered, notification messages are added to the trail files. From Creo
Parametric 2.0 M210 onward, a new environment variable PROTK_LOG_
DISABLE enables you to disable this behavior. When set to true, the
notifications messages are not added to the trail files.
Creating an ActionListener
Implementation
You can create a proper ActionListener class using either of the following
methods:
Define a separate class within the java file.
Example:
public class MyApp {
session.AddActionListener (new SolidAL1());
}
SolidAL1.java:
public class SolidAL1 extends DefaultSolidActionListener {
// Include overridden methods here.
}
Action Sources
Methods introduced:
• pfcBase.ActionSource.AddActionListener
• pfcBase.ActionSource.RemoveActionListener
Many J-Link classes inherit the ActionSource interface, but only the
following classes currently make calls to the methods of registered
ActionListeners:
• pfcSession.Session
○ Session Action Listener
○ Model Action Listener
○ Solid Action Listener
○ Model Event Action Listener
○ Feature Action Listener
• pfcCommand.UICommand
○ UI Action Listener
• pfcModel.Model (and it’s subclasses)
○ Model Action Listener
○ Parameter Action Listener
• pfcSolid.Solid (and it’s subclasses)
○ Solid Action Listener
Note
Assigning an action listener to a source not related to it will not cause an
error but the listener method will never be called.
The methods
pfcSession.SessionActionListener.OnBeforeModelErase,
pfcSession.SessionActionListener.OnBeforeModelRename,
pfcSession.SessionActionListener.OnBeforeModelSave, and
pfcSession.SessionActionListener.OnBeforeModelCopy take
special arguments. They are designed to allow you to fill in the arguments and
pass this data back to PTC Creo Parametric. The model names placed in the
descriptors will be used by PTC Creo Parametric as the default names in the user
interface.
Note
The method
pfcModel.ModelActionListener.OnBeforeModelDisplay is
not supported in asynchronous mode.
Note
• It is not recommended to modify geometry or dimensions using the
pfcSolid.SolidActionListener.OnBeforeRegenerate method
call.
• A regeneration that did not take place because nothing was modified is
identified as a regeneration failure.
The pfcSolid.SolidActionListener.OnBeforeFeatureCreate
method activates when the user starts to create a feature that requires the Feature
Creation dialog box. Because this event occurs only after the dialog box is
displayed, it will not occur at all for datums and other features that do not use this
dialog box. This method takes two arguments: the solid model that will contain
the feature and the ModelItem identifier.
The pfcSolid.SolidActionListener.OnAfterFeatureCreate
method activates after any feature, including datums, has been created. This
method takes the new Feature object as an argument.
The pfcSolid.SolidActionListener.OnAfterFeatureDelete
method activates after any feature has been deleted. The method receives the solid
that contained the feature and the (now defunct) ModelItem identifier.
This chapter describes various methods of importing and exporting files in J-Link.
301
Exporting Files and 2D Models
Method Introduced:
• pfcModel.Model.Export
The method pfcModel.Model.Export exports model data to a file. The
exported files are placed in the current PTC Creo Parametric working directory.
The input parameters are:
• filename—Output file name including extensions
• exportdata—The pfcModel.ExportInstructions object that controls
the export operation. The type of data that is exported is given by the
pfcModel.ExportType object.
There are four general categories of files to which you can export models:
• File types whose instructions inherit from
pfcModel.GeomExportInstructions.
These instructions export files that contain precise geometric information used
by other CAD systems.
• File types whose instructions inherit from
pfcModel.CoordSysExportInstructions.
These instructions export files that contain coordinate information describing
faceted, solid models (without datums and surfaces).
• File types whose instructions inherit from
pfcModel.FeatIdExportInstructions.
These instructions export information about a specific feature.
• General file types that inherit only from
pfcModel.ExportInstructions.
These instructions provide conversions to file types such as BOM (bill of
materials).
For information on exporting to a specific format, see the J-Link APIWizard and
online help for the PTC Creo Parametric interface.
Export Instructions
Methods Introduced:
• pfcModel.pfcModel.RelationExportInstructions_Create
• pfcModel.pfcModel.ModelInfoExportInstructions_Create
• pfcModel.pfcModel.ProgramExportInstructions_Create
• pfcModel.pfcModel.IGESFileExportInstructions_Create
Interface 303
Used to Export
STLASCIIExportInstructions A part or assembly to an ASCII STL file
STLBinaryExportInstructions A part or assembly in a binary STL file
BOMExportInstructions A BOM for an assembly
DWGSetupExportInstructions A drawing setup file
FeatInfoExportInstructions Information about one feature in a part or assembly
MfgFeatCLExportInstructions A cutter location (CL) file for one NC sequence in a
manufacturing assembly
MfgOperClExportInstructions A cutter location (CL) file for all the NC sequences
in a manufacturing assembly
MaterialExportInstructions A material from a part
CGMFILEExportInstructions A drawing in CGM format
InventorExportInstructions A part or assembly in Inventor format
FIATExportInstructions A part or assembly in FIAT format
ConnectorParamExportInstructions The parameters of a connector to a text file
CableParamsFileInstructions Cable parameters from an assembly
CATIAFacetsExportInstructions A part or assembly in CATIA format (as a faceted
model)
VRMLModelExportInstructions A part or assembly in VRML format
STEP2DExportInstructions A two-dimensional STEP format file
MedusaExportInstructions A drawing in MEDUSA file
CADDSExportInstructions A CADDS5 solid model
NEUTRALFileExportInstructions A PTC Creo Parametric part to neutral format
ProductViewExportInstructions A part, assembly, or drawing in PTC Creo View
format
Export.SliceExportData A slice export format
Note
The New Instruction Classes replace the following Deprecated Classes:
Interface 305
• pfcExport.TriangulationInstructions.GetAngleControl
• pfcExport.TriangulationInstructions.SetAngleControl
• pfcExport.TriangulationInstructions.GetChordHeight
• pfcExport.TriangulationInstructions.SetChordHeight
• pfcExport.TriangulationInstructions.GetStepSize
• pfcExport.TriangulationInstructions.SetStepSize
• pfcExport.TriangulationInstructions.GetFacetControlOptions
• pfcExport.TriangulationInstructions.SetFacetControlOptions
The methods
pfcExport.TriangulationInstructions.GetAngleControl and
pfcExport.TriangulationInstructions.SetAngleControl gets
and sets the angle control for the exported facet drawings and models. You can set
the value between 0.0 to 1.0.
Use the methods
pfcExport.TriangulationInstructions.GetChordHeight and
pfcExport.TriangulationInstructions.SetChordHeight to get
and set the chord height for the exported facet drawings and models.
The methods
pfcExport.TriangulationInstructions.GetStepSize and
pfcExport.TriangulationInstructions.SetStepSize allow you
to control the step size for the exported files. The default value is 0.0.
Note
You must pass the value of Step Size value as NULL, if you specify the
Quality value.
The methods
pfcModel.CoordSysExportInstructions.GetStepSize and
pfcModel.CoordSysExportInstructions.SetStepSize control the
step size for the exported files. The default value is 0.0.
Note
You must pass the value of Step Size value as NULL, if you specify the
Quality value.
The methods
pfcExport.TriangulationInstructions.GetFacetControlOp
tions and
Note
To include annotations, during the export of PTC Creo Parametric model,
you must call the method pfcModel.Model.Display before calling
pfcModel.Model.Export.
Interface 307
• pfcModel.CoordSysExportInstructions.GetCsysName
• pfcModel.CoordSysExportInstructions.SetCsysName
• pfcModel.CoordSysExportInstructions.GetQuality
• pfcModel.CoordSysExportInstructions.SetQuality
• pfcModel.CoordSysExportInstructions.GetMaxChordHeight
• pfcModel.CoordSysExportInstructions.SetMaxChordHeight
• pfcModel.CoordSysExportInstructions.GetAngleControl
• pfcModel.CoordSysExportInstructions.SetAngleControl
• pfcModel.CoordSysExportInstructions.GetSliceExportData
• pfcModel.CoordSysExportInstructions.SetSliceExportData
• pfcModel.CoordSysExportInstructions.GetStepSize
• pfcModel.CoordSysExportInstructions.SetStepSize
• pfcModel.CoordSysExportInstructions.GetFacetControlOptions
• pfcModel.CoordSysExportInstructions.SetFacetControlOptions
The method
pfcModel.CoordSysExportInstructions.GetCsysName returns the
name of the the name of a coordinate system feature in the model being exported.
It is recommended to use the coordinate system that places the part or assembly in
its upper-right quadrant, so that all position and distance values of the exported
assembly or part are positive. The method
pfcModel.CoordSysExportInstructions.SetCsysName allows you
to set the coordinate system feature name.
The methods pfcModel.CoordSysExportInstructions.GetQuality
and pfcModel.CoordSysExportInstructions.SetQuality can be
used instead of
pfcModel.CoordSysExportInstructions.GetMaxChordHeight
and
pfcModel.CoordSysExportInstructions.GetMaxChordHeight
and pfcModel.CoordSysExportInstructions.GetAngleControl
and pfcModel.CoordSysExportInstructions.SetAngleControl.
Note
You must pass the value of Quality as NULL, if you use Maximum Chord
Height and Angle Control values. If Quality, Maximum Chord Height, and
Angle Control are all NULL, then the Quality setting of 3 is used.
Note
You must pass the value of Maximum Chord Height as NULL, if you specify
the Quality value.
The methods
pfcModel.CoordSysExportInstructions.GetAngleControl and
pfcModel.CoordSysExportInstructions.SetAngleControl allow
you to work with the angle control setting for the exported files. The default value
is 0.1.
Note
You must pass the value of Angle Control value as NULL, if you specify the
Quality value.
The methods
pfcModel.CoordSysExportInstructions.GetSliceExportData
and
pfcModel.CoordSysExportInstructions.SetSliceExportData
get and set the pfcModel.SliceExportData data object that specifies data
for the slice export. The options in this object are described as follows:
• CompIds—Specifies the sequence of integers that identify the components that
form the path from the root assembly down to the component part or assembly
being referred to. Use the methods
Interface 309
pfcModel.SliceExportData.GetCompIds and
pfcModel.SliceExportData.SetCompIds to work with the
component IDs.
The methods
pfcModel.CoordSysExportInstructions.GetStepSize and
pfcModel.CoordSysExportInstructions.SetStepSize control the
step size for the exported files. The default value is 0.0.
Note
You must pass the value of Step Size value as NULL, if you specify the
Quality value.
The methods
pfcModel.CoordSysExportInstructions.GetFacetControlOp
tions and
pfcModel.CoordSysExportInstructions.SetFacetControlOp
tions control the facet export options using bit flags. You can set the bit flags
using the pfcModel.FacetControlFlag object. For more information on the
bit flag values, please refer to the section Exporting to Faceted Formats on page
305.
Interface 311
Note
You can specify the profile path only for drawings.
Interface 313
• PDFOPT_RESTRICT_OPERATIONS—If true, enables you to restrict or limit
operations on the PDF document. By default, is is false.
• PDFOPT_ALLOW_MODE—Enables you to set the security settings for the
PDF document. This option must be set if PDFOPT_RESTRICT_
OPERATIONS is set to true. It is given by the
pfcExport.PDFRestrictOperationsMode class and takes the
following values:
○ PDF_RESTRICT_NONE—Specifies that the user can perform any of the
permitted viewer operations on the PDF document. This is the default
value.
○ PDF_RESTRICT_FORMS_SIGNING—Restricts the user from adding
digital signatures to the PDF document.
○ PDF_RESTRICT_INSERT_DELETE_ROTATE—Restricts the user from
inserting, deleting, or rotating the pages in the PDF document.
○ PDF_RESTRICT_COMMENT_FORM_SIGNING—Restricts the user from
adding or editing comments in the PDF document.
○ PDF_RESTRICT_EXTRACTING—Restricts the user from extracting
pages from the PDF document.
• PDFOPT_ALLOW_PRINTING—If true, allows you to print the PDF
document. By default, it is true.
• PDFOPT_ALLOW_PRINTING_MODE—Enables you to set the print
resolution. It is given by the pfcExport.PDFPrintingMode class and
takes the following values:
○ PDF_PRINTING_LOW_RES—Specifies low resolution for printing.
○ PDF_PRINTING_HIGH_RES—Specifies high resolution for printing.
This is the default value.
• PDFOPT_ALLOW_COPYING—If true, allows you to copy content from the
PDF document. By default, it is true.
• PDFOPT_ALLOW_ACCESSIBILITY—If true, enables visually-impaired
screen reader devices to extract data independent of the value given by the
pfcExport.PDFRestrictOperationsMode class. The default value is
true.
• PDFOPT_PENTABLE—If true, uses the standard PTC Creo Parametric
pentable to control the line weight, line style, and line color of the exported
geometry. The default value is false.
• PDFOPT_LINECAP—Enables you to control the treatment of the ends of the
geometry lines exported to PDF. It is given by the
pfcExport.PDFLinecap class and takes the following values:
Interface 315
• PDFOPT_LIGHT_DEFAULT—Enables you to set the default lighting style
used while exporting 3D models in the U3D format to a one-page PDF file,
that is when the option PDFOPT_EXPORT_MODE is set to PDF_3D_AS_
U3D. The values for this option are given by the
pfcExport.PDFU3DLightingMode class.
• PDFOPT_RENDER_STYLE_DEFAULT—Enables you to set the default
rendering style used while exporting PTC Creo Parametric models in the U3D
format to a one-page PDF file, that is when the option PDFOPT_EXPORT_
MODE is set to PDF_3D_AS_U3D. The values for this option are given by the
pfcModel.PDFU3DRenderMode class.
• PDFOPT_SIZE—Allows you to specify the page size of the exported PDF
file. The values for this option are given by the
pfcExport.PlotPaperSize class. If the value is set to
VARIABLESIZEPLOT, you also need to set the options PDFOPT_HEIGHT
and PDFOPT_WIDTH.
• PDFOPT_HEIGHT—Enables you to set the height for a user-defined page size
of the exported PDF file. The default value is 0.0.
• PDFOPT_WIDTH—Enables you to set the width for a user-defined page size
of the exported PDF file. The default value is 0.0.
• PDFOPT_ORIENTATION—Enables you to specify the orientation of the
pages in the exported PDF file. It is given by the
pfcSheet.SheetOrientation class.
○ ORIENT_PORTRAIT—Exports the pages in portrait orientation. This is
the default value.
○ ORIENT_LANDSCAPE—Exports the pages in landscape orientation.
• PDFOPT_TOP_MARGIN—Allows you to specify the top margin of the view
port. The default value is 0.0.
• PDFOPT_LEFT_MARGIN—Allows you to specify the left margin of the view
port. The default value is 0.0.
• PDFOPT_BACKGROUND_COLOR_RED—Specifies the default red
background color that appears behind the U3D model. You can set any value
within the range of 0.0 to 1.0. The default value is 1.0.
• PDFOPT_BACKGROUND_COLOR_GREEN—Specifies the default green
background color that appears behind the U3D model. You can set any value
within the range of 0.0 to 1.0. The default value is 1.0.
• PDFOPT_BACKGROUND_COLOR_BLUE—Specifies the default blue
background color that appears behind the U3D model. You can set any value
within the range of 0.0 to 1.0. The default value is 1.0.
Exporting 3D Geometry
J-Link allows you to export three dimensional geometry to various formats. Pass
the instructions object containing information about the desired export file to the
method pfcModel.Model.Export.
Interface 317
Export Instructions
Methods Introduced:
• pfcExport.Export3DInstructions.GetConfiguration
• pfcExport.Export3DInstructions.SetConfiguration
• pfcExport.Export3DInstructions.GetReferenceSystem
• pfcExport.Export3DInstructions.SetReferenceSystem
• pfcExport.Export3DInstructions.GetGeometry
• pfcExport.Export3DInstructions.SetGeometry
• pfcExport.Export3DInstructions.GetIncludedEntities
• pfcExport.Export3DInstructions.SetIncludedEntities
• pfcExport.Export3DInstructions.GetLayerOptions
• pfcExport.Export3DInstructions.SetLayerOptions
• pfcExport.pfcExport.GeometryFlags_Create
• pfcExport.pfcExport.InclusionFlags_Create
• pfcExport.pfcExport.LayerExportOptions_Create
• pfcExport.pfcExport.STEP3DExportInstructions_Create
• pfcExport.pfcExport.VDA3DExportInstructions_Create
• pfcExport.pfcExport.IGES3DNewExportInstructions_Create
• pfcExport.pfcExport.CATIAModel3DExportInstructions_Create
• pfcExport.pfcExport.ACIS3DExportInstructions_Create
• pfcExport.pfcExport.CatiaPart3DExportInstructions_Create
• pfcExport.pfcExport.CatiaProduct3DExportInstructions_Create
• pfcExport.pfcExport.CatiaCGR3DExportInstructions_Create
• pfcExport.pfcExport.DXF3DExportInstructions_Create
• pfcExport.pfcExport.DWG3DExportInstructions_Create
• pfcExport.pfcExport.JT3DExportInstructions_Create
• pfcExport.pfcExport.ParaSolid3DExportInstructions_Create
• pfcExport.pfcExport.UG3DExportInstructions_Create
• pfcExport.pfcExport.TriangulationInstructions_Create
The pfcExport.Export3DInstructions contains data to export a part or
an assembly to a specifed 3D format. The fields of this are:
• AssemblyConfiguration—While exporting an assembly you can
specify the structure and contents of the output files. The options are:
Interface 319
○ LayerSetupFile—Specifies the name and complete path of the layer setup
file. This file contains the layer assignment information which includes the
name of the layer, its display status, the interface ID and number of sub
layers.
The method pfcExport.pfcExport.TriangulationInstructions_
Create creates a object that will be used to define the parameters for faceted
exports.
Export Utilities
Methods Introduced:
• pfcSession.BaseSession.IsConfigurationSupported
• pfcSession.BaseSession.IsGeometryRepSupported
The method
pfcSession.BaseSession.IsConfigurationSupported checks
whether the specified assembly configuration is valid for a particular model and
the specified export format. The input parameters for this method are:
• Configuration—Specifies the structure and content of the output files.
• Type—Specifies the output file type to create.
The method returns a true value if the configuration is supported for the specified
export type.
Shrinkwrap Export
To improve performance in a large assembly design, you can export lightweight
representations of models called shrinkwrap models. A shrinkwrap model is based
on the external surfaces of the source part or asssembly model and captures the
outer shape of the source model.
You can create the following types of nonassociative exported shrinkwrap models:
• Surface Subset—This type consists of a subset of the original model’s
surfaces.
• Faceted Solid—This type is a faceted solid representing the original solid.
• Merged Solid—The external components from the reference assembly model
are merged into a single part representing the solid geometry in all collected
components.
Methods Introduced:
• pfcSolid.Solid.ExportShrinkwrap
You can export the specified solid model as a shrinkwrap model using the method
pfcSolid.Solid.ExportShrinkwrap. This method takes the
ShrinkwrapExportInstructions object as an argument.
Use the appropriate given in the following table to create the required type of
shrinkwrap. All the have their own static method to create an object of the
specified type. The object created by these interfaces can be used as an object of
type ShrinkwrapExportInstructions or
ShrinkwrapModelExportInstructions.
Interface 321
Type of Shrinkwrap Model to Use
Surface Subset ShrinkwrapSurfaceSubset
Instructions
Faceted Part ShrinkwrapFacetedPart
Instructions
Faceted VRML ShrinkwrapFacetedVRML
Instructions
Faceted STL ShrinkwrapFacetedSTLInstructions
Merged Solid ShrinkwrapMergedSolidInstructions
Interface 323
The method
pfcShrinkwrap.ShrinkwrapModelExportInstructions.
GetAssign
MassProperties determines the mass property of the model. The method
pfcShrinkwrap.ShrinkwrapModelExportInstructions.SetAs
sign
MassProperties assign mass properties to the shrinkwrap model. The default
value is false and the mass properties of the original model is assigned to the
shrinkwrap model. If the value is set to true, the user must assign a value for the
mass properties.
The method pfcShrinkwrap.ShrinkwrapModelExport
Instructions.GetIgnoreSmallSurfaces specifies whether small
surfaces are ignored during the creation of a shrinkwrap model. The method
pfcShrinkwrap.ShrinkwrapModelExportInstructions
.SetIgnore
SmallSurfaces sets a flag that forces PTC Creo Parametric to skip surfaces
smaller than a certain size. The default value is false. The size of the surface is
specified as a percentage of the model’s size. This size can be modified using the
methods pfcShrinkwrap.ShrinkwrapModelExportInstructions
.GetSmall
SurfPercentage and
pfcShrinkwrap.ShrinkwrapModelExportInstructions.Set
SmallSurfPercentage.
The methodproperty
pfcShrinkwrap.ShrinkwrapModelExportInstructions.Get
DatumReferences and
pfcShrinkwrap.ShrinkwrapModelExportInstructions.SetDa
tum
References specify and select the datum planes, points, curves, axes, and
coordinate system references to be included in the shrinkwrap model.
Interface 325
pfcShrinkwrap.ShrinkwrapFacetedFormatInstructions.Set
FramesFile enable you to select a frame file to create a faceted solid motion
envelope model that represents the full motion of the mechanism captured in the
frame file. Specify the name and complete path of the frame file.
Interface 327
Components specifies individual components of the assembly to be merged into
the shrinkwrap model. Use the method
pfcShrinkwrap.ShrinkwrapMergedSolidInstructions.SetAddi
tional
Components to select individual components of the assembly to be merged into
the shrinkwrap model.
Importing Files
Method Introduced:
• pfcModel.Model.Import
The method pfcModel.Model.Import reads a file into PTC Creo
Parametric. The format must be the same as it would be if these files were created
by PTC Creo Parametric. The parameters are:
• FilePath—Absolute path of the file to be imported along with its extension.
• ImportData—The ImportInstructions object that controls the import
operation.
Import Instructions
Methods Introduced:
• pfcModel.pfcModel.RelationImportInstructions_Create
• pfcModel.pfcModel.IGESSectionImportInstructions_Create
• pfcModel.pfcModel.ProgramImportInstructions_Create
• pfcModel.pfcModel.ConfigImportInstructions_Create
• pfcModel.pfcModel.DWGSetupImportInstructions_Create
• pfcModel.pfcModel.SpoolImportInstructions_Create
• pfcModel.pfcModel.ConnectorParamsImportInstructions_Create
• pfcModel.pfcModel.ASSEMTreeCFGImportInstructions_Create
• pfcModel.pfcModel.WireListImportInstructions_Create
• pfcModel.pfcModel.CableParamsImportInstructions_Create
• pfcModel.pfcModel.STEPImport2DInstructions_Create
• pfcModel.pfcModel.IGESImport2DInstructions_Create
• pfcModel.pfcModel.DXFImport2DInstructions_Create
• pfcModel.pfcModel.DWGImport2DInstructions_Create
Note
• The method pfcModel.Model.Import does not support importing of
CADAM type of files.
• If a model or the file type STEP, IGES, DWX, or SET already exists, the
imported model is appended to the current model. For more information on
methods that return models of the types STEP, IGES, DWX, and SET, refer to
Getting a Model Object on page 110.
Importing 2D Models
Method Introduced:
• pfcSession.BaseSession.Import2DModel
The method pfcSession.BaseSession.Import2DModel imports a two
dimensional model based on the following parameters:
• NewModelName—Specifies the name of the new model.
• Type—Specifies the type of the model. The type can be one of the following:
○ STEP
Interface 329
○ IGES
○ DXF
○ DWG
○ SET
• FilePath—Specifies the location of the file to be imported along with the file
extension
• Instructions—Specifies the pfcModel.Import2DInstructions object
that controls the import operation.
The pfcModel.Import2DInstructions contains the following
attributes:
○ Import2DViews—Defines whether to import 2D drawing views.
○ ScaleToFit—If the current model has a different sheet size than that
specified by the imported file, set the parameter to true to retain the current
sheet size. Set the parameter to false to retain the sheet size of the imported
file.
○ FitToLeftCorner—If this parameter is set to true, the bottom left corner of
the imported file is adjusted to the bottom left corner of the current model.
If it is set to false, the size of imported file is retained.
Note
The method pfcSession.BaseSession.Import2DModel does
not support importing of CADAM type of files.
Importing 3D Geometry
Methods Introduced:
• pfcSession.BaseSession.GetImportSourceType
• pfcSession.BaseSession.ImportNewModel
• pfcImport.LayerImportFilter.OnLayerImport
For some input formats, the method
pfcSession.BaseSession.GetImportSourceType returns the type of
model that can be imported using a designated file. The input parameters of this
method are:
Interface 331
• ModelType—Specifies the type of the model. It can be a part, assembly or
drawing.
• NewModelName—Specifies a name for the imported model.
• LayerImportFilter—Specifies the layer filter. This parameter is
optional.
The interface pfcImport.LayerImportFilter has a call back function
pfcImport.LayerImportFilter.OnLayerImport. PTC Creo
Parametric passes the object pfcImport.ImportedLayer describing each
imported layer to the layer filter to allow you to perform changes on each layer as
it is imported.
The method pfcExceptions.XCancelProEAction.Throw can be called
from the body of the method
pfcImport.LayerImportFilter.OnLayerImport to end the filtering
of the layers.
Plotting Files
From Pro/ENGINEER Wildfire 5.0 onwards, the
pfcModel.PlotInstructions object containing the instructions for
plotting files has been deprecated. All the methods listed below for creating and
accessing the instruction attributes in pfcModel.PlotInstructions have
also been deprecated. Use the new interface type
pfcExport.PrinterInstructions and its methods described in the next
section.
Methods Deprecated:
• pfcModel.pfcModel.PlotInstructions_Create
• pfcModel.PlotInstructions.GetPlotterName
• pfcModel.PlotInstructions.SetPlotterName
• pfcModel.PlotInstructions.GetOutputQuality
• pfcModel.PlotInstructions.SetOutputQuality
• pfcModel.PlotInstructions.GetUserScale
• pfcModel.PlotInstructions.SetUserScale
• pfcModel.PlotInstructions.GetPenSlew
• pfcModel.PlotInstructions.SetPenSlew
• pfcModel.PlotInstructions.GetPenVelocityX
• pfcModel.PlotInstructions.SetPenVelocityX
• pfcModel.PlotInstructions.GetPenVelocityY
• pfcModel.PlotInstructions.SetPenVelocityY
• pfcModel.PlotInstructions.GetSegmentedOutput
• pfcModel.PlotInstructions.SetSegmentedOutput
• pfcModel.PlotInstructions.GetLabelPlot
Interface 333
• pfcModel.PlotInstructions.SetLabelPlot
• pfcModel.PlotInstructions.GetSeparatePlotFiles
• pfcModel.PlotInstructions.SetSeparatePlotFiles
• pfcModel.PlotInstructions.GetPaperSize
• pfcModel.PlotInstructions.SetPaperSize
• pfcModel.PlotInstructions.GetPageRangeChoice
• pfcModel.PlotInstructions.SetPageRangeChoice
• pfcModel.PlotInstructions.GetPaperSizeX
• pfcModel.PlotInstructions.SetPaperSizeY
• pfcModel.PlotInstructions.GetFirstPage
• pfcModel.PlotInstructions.SetFirstPage
• pfcModel.PlotInstructions.GetLastPage
• pfcModel.PlotInstructions.SetLastPage
Printing Files
The printer instructions for printing a file are defined in
pfcExport.PrinterInstructions data object.
Methods Introduced:
• pfcExport.pfcExport.PrinterInstructions_Create
• pfcExport.PrinterInstructions.SetPrinterOption
• pfcExport.PrinterInstructions.SetPlacementOption
• pfcExport.PrinterInstructions.SetModelOption
• pfcExport.PrinterInstructions.SetWindowId
The method pfcExport.pfcExport.PrinterInstructions_Create
creates a new instance of the pfcExport.PrinterInstructions object.
The object contains the following instruction attributes:
• PrinterOption—Specifies the printer settings for printing a file in terms of the
pfcExport.PrintPrinterOption object. Set this attribute using the
method pfcExport.PrinterInstructions.SetPrinterOption.
• PlacementOption—Specifies the placement options for printing purpose in
terms of the pfcExport.PrintMdlOption object. Set this attribute using
the method
pfcExport.PrinterInstructions.SetPlacementOption.
• ModelOption—Specifies the model options for printing purpose in terms of
the pfcExport.PrintPlacementOption object. Set this attribute
Printer Options
The printer settings for printing a file are defined in the
pfcExport.PrintPrinterOption object.
Methods Introduced:
• pfcExport.pfcExport.PrintPrinterOption_Create
• pfcSession.BaseSession.GetPrintPrinterOptions
• pfcExport.PrintPrinterOption.SetDeleteAfter
• pfcExport.PrintPrinterOption.SetFileName
• pfcExport.PrintPrinterOption.SetPaperSize
• pfcExport.pfcExport.PrintSize_Create
• pfcExport.PrintSize.SetHeight
• pfcExport.PrintSize.SetWidth
• pfcExport.PrintSize.SetPaperSize
• pfcExport.PrintPrinterOption.SetPenTable
• pfcExport.PrintPrinterOption.SetPrintCommand
• pfcExport.PrintPrinterOption.SetPrinterType
• pfcExport.PrintPrinterOption.SetQuantity
• pfcExport.PrintPrinterOption.SetRollMedia
• pfcExport.PrintPrinterOption.SetRotatePlot
• pfcExport.PrintPrinterOption.SetSaveMethod
• pfcExport.PrintPrinterOption.SetSaveToFile
• pfcExport.PrintPrinterOption.SetSendToPrinter
• pfcExport.PrintPrinterOption.SetSlew
• pfcExport.PrintPrinterOption.SetSwHandshake
• pfcExport.PrintPrinterOption.SetUseTtf
The method pfcExport.pfcExport.PrintPrinterOption_Create
creates a new instance of the pfcExport.PrintPrinterOption object.
The method pfcSession.BaseSession.GetPrintPrinterOptions
retrieves the printer settings.
Interface 335
The pfcExport.PrintPrinterOption object contains the following
options:
• DeleteAfter—Determines if the file is deleted after printing. Set it to true to
delete the file after printing. Use the method
pfcExport.PrintPrinterOption.SetDeleteAfter to assign this
option.
• FileName—Specifies the name of the file to be printed. Use the method
pfcExport.PrintPrinterOption.SetFileName to set the name.
Note
If the method pfcModel.Model.Export is called for
pfcModel.ExportType object, then the argument FileName is
ignored, and can be passed as NULL. You must use the method
pfcModel.Model.Export to set the FileName.
Interface 337
Placement Options
The placement options for printing purpose are defined in the
pfcExport.PrintPlacementOption object.
Methods Introduced:
• pfcExport.pfcExport.PrintPlacementOption_Create
• pfcSession.BaseSession.GetPrintPlacementOptions
• pfcExport.PrintPlacementOption.SetBottomOffset
• pfcExport.PrintPlacementOption.SetClipPlot
• pfcExport.PrintPlacementOption.SetKeepPanzoom
• pfcExport.PrintPlacementOption.SetLabelHeight
• pfcExport.PrintPlacementOption.SetPlaceLabel
• pfcExport.PrintPlacementOption.SetScale
• pfcExport.PrintPlacementOption.SetShiftAllCorner
• pfcExport.PrintPlacementOption.SetSideOffset
• pfcExport.PrintPlacementOption.SetX1ClipPosition
• pfcExport.PrintPlacementOption.SetX2ClipPosition
• pfcExport.PrintPlacementOption.SetY1ClipPosition
• pfcExport.PrintPlacementOption.SetY2ClipPosition
The method pfcExport.pfcExport.PrintPlacementOption_
Create creates a new instance of the
pfcExport.PrintPlacementOption object.
The method
pfcSession.BaseSession.GetPrintPlacementOptions retrieves
the placement options.
The pfcExport.PrintPlacementOption object contains the following
options:
• BottomOffset—Specifies the offset from the lower-left corner of the plot. Use
the method
pfcExport.PrintPlacementOption.SetBottomOffset to set
this option.
• ClipPlot—Specifies whether the plot is clipped. Set this option to true to clip
the plot or to false to avoid clipping of plot. Use the method
pfcExport.PrintPlacementOption.SetClipPlot to set this
option.
• KeepPanzoom—Determines whether pan and zoom values of the window are
used. Set this option to true use pan and zoom and false to skip them. Use the
Model Options
The model options for printing purpose are defined in the
pfcExport.PrintMdlOption object.
Methods Introduced:
Interface 339
• pfcExport.pfcExport.PrintMdlOption_Create
• pfcSession.BaseSession.GetPrintMdlOptions
• pfcExport.PrintMdlOption.SetDrawFormat
• pfcExport.PrintMdlOption.SetFirstPage
• pfcExport.PrintMdlOption.SetLastPage
• pfcExport.PrintMdlOption.SetLayerName
• pfcExport.PrintMdlOption.SetLayerOnly
• pfcExport.PrintMdlOption.SetMdl
• pfcExport.PrintMdlOption.SetQuality
• pfcExport.PrintMdlOption.SetSegmented
• pfcExport.PrintMdlOption.SetSheets
• pfcExport.PrintMdlOption.SetUseDrawingSize
• pfcExport.PrintMdlOption.SetUseSolidScale
The method pfcExport.pfcExport.PrintMdlOption_Create creates
a new instance of the pfcExport.PrintMdlOption object.
The method pfcSession.BaseSession.GetPrintMdlOptions
retrieves the model options.
The pfcExport.PrintMdlOption object contains the following options:
• DrawFormat—Displays the drawing format used for printing. Use the method
pfcExport.PrintMdlOption.SetDrawFormat to set this option.
• FirstPage—Specifies the first page number. Use the method
pfcExport.PrintMdlOption.SetFirstPage to set this option.
• LastPage—Specifies the last page number. Use the method
pfcExport.PrintMdlOption.SetLastPage to set this option.
• LayerName—Specifies the name of the layer. Use the method
pfcExport.PrintMdlOption.SetLayerName to set the name.
• LayerOnly—Prints the specified layer only. Set this option to true to print
the specified layer. Use the method
pfcExport.PrintMdlOption.SetLayerOnly to set this option.
• Mdl—Specifies the model to be printed. Use the method
pfcExport.PrintMdlOption.SetMdl to set this option.
• Quality—Determines the quality of the model to be printed. It checks for no
line, no overlap, simple overlap, and complex overlap. Use the method
pfcExport.PrintMdlOption.SetQuality to set this option.
• Segmented—If set to true, the printer prints the drawing in full size, but in
segments that are compatible with the selected paper size. This option is
Interface 341
the method
pfcExport.PrinterPCFOptions.SetPlacementOption.
• ModelOption—Specifies the model options for printing purpose in terms of
the pfcExport.PrintPlacementOption object. Set this attribute
using the method
pfcExport.PrinterPCFOptions.SetModelOption.
Solid Operations
Method Introduced:
• pfcSolid.Solid.CreateImportFeat
The method pfcSolid.Solid.CreateImportFeat creates a new import
feature in the solid and takes the following input arguments:
• IntfData—The source of data from which to create the import feature. It is
given by the pfcModel.IntfDataSource object. The type of source data
that can be imported is given by the pfcModel.IntfType class and can be
of the following types:
○ INTF_NEUTRAL
○ INTF_NEUTRAL_FILE
○ INTF_IGES
○ INTF_STEP
○ INTF_VDA
○ INTF_ICEM
○ INTF_ACIS
○ INTF_DXF
○ INTF_CDRS
○ INTF_STL
○ INTF_VRML
○ INTF_PARASOLID
○ INTF_AI
○ INTF_CATIA_PART
○ INTF_UG
○ INTF_PRODUCTVIEW
○ INTF_CATIA_CGR
Window Operations
Method Introduced:
• pfcWindow.Window.ExportRasterImage
The method pfcWindow.Window.ExportRasterImage outputs a standard
PTC Creo Parametric raster output file.
Interface 343
24
Simplified Representations
Overview ................................................................................................................ 346
Retrieving Simplified Representations....................................................................... 347
Creating and Deleting Simplified Representations...................................................... 348
Extracting Information About Simplified Representations............................................ 348
Modifying Simplified Representations ....................................................................... 349
Simplified Representation Utilities............................................................................. 350
345
Overview
Using J-Link, you can create and manipulate assembly simplified representations
just as you can using PTC Creo Parametric interactively.
Note
J-Link supports simplified representation of assemblies only, not parts.
Note
J-Link supports simplified representation of Assemblies only, not Parts.
353
Overview
Asynchronous mode is a multiprocess mode in which the J-Link application and
PTC Creo Parametric can perform concurrent operations. Unlike the synchronous
modes, asynchronous mode uses JNI (Java Native Interface) and RPC (remote
procedure calls) as the means of communication between the application and PTC
Creo Parametric.
Another important difference between synchronous and asynchronous modes is in
the startup of the J-Link application. In synchronous mode, the application is
started by PTC Creo Parametric, based on information contained in the registry
file. In asynchronous mode, the application (containing its own main() method) is
started independently of PTC Creo Parametric and subsequently either starts or
connects to a PTC Creo Parametric process.
Note
An asynchronous application that starts PTC Creo Parametric will not appear
in the Auxiliary Applications dialog box.
The use of RPC causes asynchronous mode to perform more slowly than
synchronous mode. For this reason, apply asynchronous mode only when it is
needed.
An asynchronous mode is not the only mode in which your application has
explicit control over PTC Creo Parametric. Because PTC Creo Parametric calls a
Java start method when an application starts, your synchronous application can
take control by initiating all operations in Java start method (thus interrupting any
user interaction). This technique is important when you want to run PTC Creo
Parametric in batch mode.
Depending on how your asynchronous application handles messages from PTC
Creo Parametric, your application can be classified as either simple or full.
The following sections describe simple and full asynchronous mode.
Note
Asynchronous applications are incompatible with the classes in the
synchronous .jar files. You must build and run your application classes
specifically to run in asynchronous mode.
You must add the asynchronous library, pfcasyncmt, to your environment that
launches the J-Link application. This library is stored in <creo_loadpoint>\
<datecode>\Common Files\<machine type>\<lib>.
Note
The library has prefix and extension specifiers for a dynamically loaded
library for the platform being used.
Asynchronous J-Link applications must load the library prior to calls made to the
asynchronous methods. This can be accomplished by adding the following line to
your application.
System.loadLibrary (“pfcasyncmt”)
Note
Both of these arguments are required, but the order is not important.
Example Code
The sample code in the file pfcAsyncStartExample.java located at
<creo_jlink_loadpoint>/jlink_appls/jlinkasyncexamples
demonstrates how to use J-Link in asynchronous mode. The method starts PTC
Creo Parametric asynchronously, retrieves a Session, and opens a model in PTC
Creo Parametric.
Note
Connection IDs are unique for each PTC Creo Parametric process and are not
maintained after you quit PTC Creo Parametric.
Methods Introduced:
• pfcAsyncConnection.AsyncConnection.EventProcess
• pfcAsyncConnection.AsyncConnection.WaitForEvents
• pfcAsyncConnection.AsyncConnection.InterruptEventProcessing
• pfcAsyncConnection.AsyncActionListener.OnTerminate
The control loop of an application running in full asynchronous mode must
contain a call to the method
pfcAsyncConnection.AsyncConnection.EventProcess, which
takes no arguments. This method allows the application to respond to messages
sent from PTC Creo Parametric. For example, if the user selects a menu button
that is added by your application,
pfcAsyncConnection.AsyncConnection.EventProcess processes
the call to your listener and returns when the call completes. For more information
on listeners and adding menu buttons, see the Session Objects on page 65 chapter.
The method
pfcAsyncConnection.AsyncConnection.WaitForEvents provides
an alternative to the development of an event processing loop in a full
asynchronous mode application. Call this function to have the application wait in
a loop for events to be passed from PTC Creo Parametric. No other processing
takes place while the application is waiting. The loop continues until
pfcAsyncConnection.AsyncConnection.InterruptEventPro
cessing is called from a J-Link callback action, or until the application detects
the termination of PTC Creo Parametric.
It is often necessary for your full asynchronous application to be notified of the
termination of the PTC Creo Parametric process. In particular, your control loop
need not continue to listen for PTC Creo Parametric messages if PTC Creo
Parametric is no longer running.
An AsyncConnection object can be assigned an Action Listener to bind a
termination action that is executed upon the termination of PTC Creo Parametric.
The method
pfcAsyncConnection.AsyncActionListener.OnTerminate
Example Code
The sample code in the file pfcAsyncFullExample.java located at
<creo_jlink_loadpoint>/jlink_appls/jlinkasyncexamples is
a fully asynchronous application. It follows the procedure for a full asynchronous
application:
1. The application establishes listeners for PTC Creo Parametric events, in this
case, the menu button and the termination listener.
2. The application goes into a control loop calling EventProcess which allows
the application to respond to the PTC Creo Parametric events.
pfcExceptions.XToolkitGeneralError or pfcExceptions.CommError on
the first call to pfcAsyncConnection.pfcAsyncConnection.
AsyncConnection_Start or pfcAsyncConnection.
pfcAsyncConnection.AsyncConnection_Connect
• Make sure the environment variable PRO_COMM_MSG_EXE is set to full path
to pro_comm_msg, including file name, including .exe on Windows.
• Make sure the environment variable PRO_DIRECTORY is set to PTC Creo
Parametric installation directory.
• Make sure name service () is running.
pfcAsyncConnection.pfcAsyncConnection.AsyncConnection_Start
hangs, even though PTC Creo Parametric already started
Make sure name service () is also started with PTC Creo Parametric. Open Task
Manager and look for nmsd.exe in the process listing.
Applications created using different PTC Creo Parametric API products are
interoperable. These products use PTC Creo Parametric as the medium of
interaction, eliminating the task of writing native-platform specific interactions
between different programming languages.
Application interoperability allows J-Link applications to call into PTC Creo
Parametric TOOLKIT from areas not covered in the native interface. It allows you
to put a Java front end on legacy PTC Creo Parametric TOOLKIT applications,
and also allows you to use J-Link applications and listeners in conjunction with a
or asynchronous J-Link application.
J-Link can call PTC Creo Parametric web pages belonging to Web.Link, and
functions in PTC Creo Parametric TOOLKIT DLLs. J-Link synchronous
applications can also register tasks for use by other applications.
365
Managing Application Arguments
J-Link passes application data to and from tasks in other applications as members
of a sequence of pfcArgument.Argument objects. Application arguments
consist of a label and a value. The value may be of any one of the following types:
• Integer
• Double
• Boolean
• ASCII string (a non-encoded string, provided for compatibility with arguments
provided from C applications)
• String (a fully encoded string)
• pfcSelect.Selection (a selection of an item in a PTC Creo Parametric
session)
• pfcBase.Transform3D (a coordinate system transformation matrix)
Methods Introduced:
• pfcArgument.pfcArgument.CreateIntArgValue
• pfcArgument.pfcArgument.CreateDoubleArgValue
• pfcArgument.pfcArgument.CreateBoolArgValue
• pfcArgument.pfcArgument.CreateASCIIStringArgValue
• pfcArgument.pfcArgument.CreateStringArgValue
• pfcArgument.pfcArgument.CreateSelectionArgValue
• pfcArgument.pfcArgument.CreateTransformArgValue
• pfcArgument.ArgValue.Getdiscr
• pfcArgument.ArgValue.GetIntValue
• pfcArgument.ArgValue.SetIntValue
• pfcArgument.ArgValue.GetDoubleValue
• pfcArgument.ArgValue.SetDoubleValue
• pfcArgument.ArgValue.GetBoolValue
• pfcArgument.ArgValue.SetBoolValue
• pfcArgument.ArgValue.GetASCIIStringValue
• pfcArgument.ArgValue.SetASCIIStringValue
• pfcArgument.ArgValue.GetStringValue
• pfcArgument.ArgValue.SetStringValue
• pfcArgument.ArgValue.GetSelectionValue
• pfcArgument.ArgValue.SetSelectionValue
Modifying Arguments
Methods Introduced:
• pfcArgument.pfcArgument.Argument_Create
• pfcArgument.Arguments.create
• pfcArgument.Argument.GetLabel
• pfcArgument.Argument.SetLabel
• pfcArgument.Argument.GetValue
• pfcArgument.Argument.SetValue
The method pfcArgument.pfcArgument.Argument_Create creates a
new argument. Provide a name and value as the input arguments of this method.
The method pfcArgument.Arguments.create creates a new empty
sequence of task arguments.
The method pfcArgument.Argument.GetLabel returns the label of the
argument. The method pfcArgument.Argument.SetLabel sets the label
of the argument.
The method pfcArgument.Argument.GetValue returns the value of the
argument. The method pfcArgument.Argument.SetValue sets the value
of the argument.
This chapter covers J-Link Graphics including displaying lists, displaying text and
using the mouse.
373
Overview
The methods described in this section allow you to draw temporary graphics in a
display window. Methods that are identified as 2D are used to draw entities (arcs,
polygons, and text) in screen coordinates. Other entities may be drawn using the
current model’s coordinate system or the screen coordinate system’s lines, circles,
and polylines. Methods are also included for manipulating text properties and
accessing mouse inputs.
Displaying Graphics
All the methods in this section draw graphics in the PTC Creo Parametric current
window and use the color and linestyle set by calls to
pfcSession.BaseSession.SetStdColorFromRGB and
pfcSession.BaseSession.SetLineStyle. The methods draw the
graphics in the PTC Creo Parametric graphics color. The default graphics color is
white.
The methods in this section are called using the pfcDisplay.Display. This
is extended by the pfcSession.BaseSession . This architecture allows you
to call all these methods on any Session object.
By default graphic elements are not stored in the PTC Creo Parametric display
list. Thus, they do not get redrawn by PTC Creo Parametric when the user selects
View, Repaint or View, Orientation. However, if you store graphic elements in
either 2-D or 3-D display lists, PTC Creo Parametric will redraw them when
appropriate. See the section on Display Lists and Graphics on page for more
information.
Methods Introduced:
• pfcDisplay.Display.SetPenPosition
• pfcDisplay.Display.DrawLine
• pfcDisplay.Display.DrawPolyline
• pfcDisplay.Display.DrawCircle
• pfcDisplay.Display.DrawArc2D
• pfcDisplay.Display.DrawPolygon2D
The method pfcDisplay.Display.SetPenPosition sets the point at
which you want to start drawing a line. The function
pfcDisplay.Display.DrawLine draws a line to the given point from the
position given in the last call to either of the two functions. Call
pfcDisplay.Display.SetPenPosition for the start of the polyline, and
pfcDisplay.Display.DrawLine for each vertex. If you use these methods
in two-dimensional modes, use screen coordinates instead of solid coordinates.
Graphics 375
The method pfcDisplay.Display.DrawCircle uses solid coordinates for
the center of the circle and the radius value. The circle will be placed to the XY
plane of the model.
The method pfcDisplay.Display.DrawPolyline also draws polylines,
using an array to define the polyline.
In two-dimensional models the Display Graphics methods draw graphics at the
specified screen coordinates.
The method pfcDisplay.Display.DrawPolygon2D draws a polygon in
screen coordinates. The method pfcDisplay.Display.DrawArc2D draws
an arc in screen coordinates.
Note
This example uses the method transformPosition to convert the
coordinates into the 3D coordinate system of a solid model, if one is
displayed.
Graphics 377
• pfcDisplay.Display.GetSlantAngle
• pfcDisplay.Display.SetSlantAngle
These methods control the attributes of text added by calls to
pfcDisplay.Display.DrawText2D.
You can get and set the following information:
• Text height (in screen coordinates)
• Width ratio of each character, including the gap, as a proportion of the height
• Rotation angle of the whole text, in counterclockwise degrees
• Slant angle of the text, in clockwise degrees
379
External Data
This chapter describes how to store and retrieve external data. External data
enables a J-Link application to store its own data in a PTC Creo Parametric
database in such a way that it is invisible to the PTC Creo Parametric user. This
method is different from other means of storage accessible through the PTC Creo
Parametric user interface.
The J-Link interfaces used to access external data in PTC Creo Parametric are:
J-Link Type Data Type
pfcExternal.ExternalDataAccess This is the top level object and is
created when attempting to access
external data.
pfcExternal.ExternalDataClass This is a class of external data and is
identified by a unique name.
pfcExternal.ExternalDataSlot This is a container for one item of
data. Each slot is stored in a class.
pfcExternal.ExternalData This is a compact data structure that
contains either an integer, double or
string value.
Note
If you need to preserve the external data created in session, you must save the
model before calling this function. Otherwise, your data will be lost.
Note
Slot names cannot begin with a number.
Example Code
The sample code in the file pfcExternalDataExamples.java located at
<creo_jlink_loadpoint>/jlink_appls/jlinkexamples
demonstrates the usage of external data in J-Link. It provides utility methods to
convert a Java hashtable (java.util.Hashtable) to a model's external data,
and to convert external data to a hashtable.
The conversion process makes some assumptions about the type of data to store in
each data slot:
+ Short, Byte, Integer = integer external data
+ Float, Double = double external data
+ Any other Java object = String external data using the object's toString()
method.
Exceptions
Most exceptions thrown by external data methods in J-Link extend
pfcExceptions.XExternalDataError, which is a subclass of
pfcExceptions.XToolkitError.
An additional exception thrown by external data methods is
pfcExceptions.XBadExternalData. This exception signals an error
accessing data. For example, external data access might have been terminated or
the model might contain stream data from PTC Creo Parametric TOOLKIT.
The following table lists these exceptions.
PTC Creo Parametric has the capability to be directly connected to PTC Windchill
solutions, including PTC WindchillProjectLink and PDMLink servers. This access
allows users to manage and control the product data seamlessly from within PTC
Creo Parametric.
This chapter lists J-Link APIs that support PTC Windchill servers and server
operations in a connected PTC Creo Parametric session.
385
Introduction
The methods introduced in this chapter provide support for the basic PTC
Windchill server operations from within PTC Creo Parametric. With these
methods, operations such as registering a PTC Windchill server, managing
workspaces, and check in or check out of objects will be possible via J-Link. The
capabilities of these APIs are similar to the operations available from within the
PTC Creo Parametric client, with some restrictions.
Some of these APIs are supported from a non-interactive, that is, batch mode
application or asynchronous application.
Note
pfcServer.ServerLocation.GetVersion works only for PTC
Windchill servers and throws the
pfcExceptions.XToolkitUnsupported exception, if the server is
not a PTC Windchill server.
Accessing Workspaces
For every workspace, a new distinct storage location is maintained in the user’s
personal folder on the server (server-side workspace) and on the client (client-side
workspace cache). Together, the server-side workspace and the client-side
workspace cache make up the workspace.
Methods Introduced:
• pfcServer.pfcServer.WorkspaceDefinition_Create
• pfcServer.WorkspaceDefinition.GetWorkspaceName
• pfcServer.WorkspaceDefinition.GetWorkspaceContext
• pfcServer.WorkspaceDefinition.SetWorkspaceName
• pfcServer.WorkspaceDefinition.SetWorkspaceContext
The interface pfcServer.WorkspaceDefinition contains the name and
context of the workspace. The method
pfcServer.ServerLocation.CollectWorkspaces returns an array of
Aliased URL
An aliased URL serves as a handle to the server objects. You can access the server
objects in the commonspace (shared folders) and the workspace using an aliased
URL. An aliased URL is a unique identifier for the server object and its format is
as follows:
• Object in workspace has a prefix wtws
wtws://<server_alias>/<workspace_name>/<object_server_name>
where
<server_alias> is my_server
<workspace_name> is my_workspace
• Object in commonspace has a prefix wtpub
wtpub://<server_alias>/<folder_location>/<object_server_name>
For example,
wtpub://my_server/path/to/cs_folder/abcd.prt
where
<server_alias> is my_server
<folder_location> is path/to/cs_folder
Note
○ object_server_name must be in lowercase.
○ The APIs are case-sensitive to the aliased URL.
○ <object_extension> should not contain PTC Creo Parametric
versions, for example, .1 or .2, and so on.
Save
Methods Introduced:
Upload
An upload transfers PTC Creo Parametric files and any other dependencies from
the local workspace cache to the server-side workspace.
Methods Introduced:
• pfcServer.Server.UploadObjects
• pfcServer.Server.UploadObjectsWithOptions
• pfcServer.pfcServer.UploadOptions_Create
The method pfcServer.Server.UploadObjects uploads the object to the
workspace. The object to be uploaded must be present in the current PTC Creo
Parametric session. You must save the object to the workspace using
pfcModel.Model.SavepfcSession.BaseSession.ImportToCur
rentWS before attempting to upload it.
The method pfcServer.Server.UploadObjectsWithOptions uploads
objects to the workspace using the options specified in the
pfcServer.UploadOptions . These options allow you to upload the entire
workspace, auto-resolve missing references, and indicate the target folder location
for the new content during the upload. You must save the object to the workspace
using pfcModel.Model.Save, or import it to the workspace using
pfcSession.BaseSession.ImportToCurrentWS before attempting to
upload it.
Create the pfcServer.UploadOptions object using the method
pfcServer.pfcServer.UploadOptions_Create.
The methods available for setting the upload options are described in the
following section.
CheckIn
After you have finished working on objects in your workspace, you can share the
design changes with other users. The checkin operation copies the information and
files associated with all changed objects from the workspace to the PTC Windchill
database.
Methods Introduced:
• pfcServer.Server.CheckinObjects
• pfcServer.pfcServer.CheckinOptions_Create
• pfcServer.UploadBaseOptions.SetDefaultFolder
Retrieval
Standard J-Link provides several methods that are capable of retrieving models.
When using these methods with PTC Windchill servers, remember that these
methods do not check out the object to allow modifications.
Methods Introduced:
• pfcSession.BaseSession.RetrieveModel
• pfcSession.BaseSession.RetrieveModelWithOpts
• pfcSession.BaseSession.OpenFile
The methods pfcSession.BaseSession.RetrieveModel,
pfcSession.BaseSession.RetrieveModelWithOpts, and
pfcSession.BaseSession.OpenFile load an object into a session given
its name and type. The methods search for the object in the active workspace, the
local directory, and any other paths specified by the search_path configuration
option.
File Copy
J-Link provides you with the capability of copying a file from the workspace or
target folder to a location on the disk and vice-versa.
Methods Introduced:
• pfcSession.BaseSession.CopyFileToWS
• pfcSession.BaseSession.CopyFileFromWS
Use the method pfcSession.BaseSession.CopyFileToWS to copy a file
from the disk to the workspace. The file can optionally be added as secondary
content to a given workspace file. If the viewable file is added as secondary
content, a dependency is created between the PTC Creo Parametric model and the
viewable file.
Use the method pfcSession.BaseSession.CopyFileFromWS to copy a
file from the workspace to a location on disk.
When importing or exporting PTC Creo Parametric models, PTC recommends
that you use methods pfcSession.BaseSession.ImportToCurrentWS
and pfcSession.BaseSession.ExportFromCurrentWS, respectively,
to perform the import or export operation. Methods that copy individual files do
not traverse PTC Creo Parametric model dependencies, and therefore do not copy
a fully retrievable set of models at the same time.
Additionally, only the methods
pfcSession.BaseSession.ImportToCurrentWS and
pfcSession.BaseSession.ExportFromCurrentWS provide full
metadata exchange and support. That means
pfcSession.BaseSession.ImportToCurrentWS can communicate all
the PTC Creo Parametric designated parameters, dependencies, and family table
information to a PDM system while
pfcSession.BaseSession.ExportFromCurrentWS can update
exported PTC Creo Parametric data with PDM system changes to designated and
system parameters, dependencies, and family table information. Hence PTC
recommends the use of pfcSession.BaseSession.CopyFileToWS and
pfcSession.BaseSession.CopyFileFromWS to process only non-PTC
Creo Parametric files.
Delete Objects
Method Introduced:
• pfcServer.Server.RemoveObjects
The method pfcServer.Server.RemoveObjects deletes the array of
objects from the workspace. When passed with the ModelNames array as NULL,
this method removes all the objects in the active workspace.
Utility APIs
The methods specified in this section enable you to obtain the handle to the server
objects to access them. The handle may be the aliased URL or the model name of
the http URL. These utilities enable the conversion of one type of handle to
another.
Methods Introduced:
• pfcServer.Server.GetAliasedUrl
• pfcSession.BaseSession.GetModelNameFromAliasedUrl
• pfcSession.BaseSession.GetAliasFromAliasedUrl
• pfcSession.BaseSession.GetUrlFromAliasedUrl
The method pfcServer.Server.GetAliasedUrl enables you to search
for a server object by its name. Specify the complete filename of the object as the
input, for example, test_part.prt. The method returns the aliased URL for a
model on the server. For more information regarding the aliased URL, refer to the
section Aliased URL on page 392. During the search operation, the workspace
takes precedence over the shared space.
You can also use this method to search for files that are not in the PTC Creo
Parametric format. For example, my_text.txt, intf_file.stp, and so on.
The method
pfcSession.BaseSession.GetModelNameFromAliasedUrl returns
the name of the object from the given aliased URL on the server.
The method pfcSession.BaseSession.GetUrlFromAliasedUrl
converts an aliased URL to a standard URL for the objects on the server.
For example, wtws://my_alias/Creo Parametric/abcd.prt is
converted to an appropriate URL on the server as http://
server.mycompany.com/Windchill.
The method pfcSession.BaseSession.GetAliasFromAliasedUrl
returns the server alias from aliased URL.
This chapter describes the critical and miscellaneous technical changes in PTC
Creo Parametric 3.0 and J-Link. It also lists the new and superseded functions for
this release.
405
Critical Technical Changes
This section describes the changes in PTC Creo Parametric 3.0 and J-Link that
might require alteration of existing J-Link applications.
Drawings
New Function Description
pfcTableOwner.RetrieveTa Retrieves and places a drawing table in
bleByOrigin the drawing at the specified point. The
origin of the table is positioned at the
specified point.
413
Installing J-Link
J-Link is available on the same CD as PTC Creo Parametric. When PTC Creo
Parametric is installed using PTC.SetUp, one of the optional components is API
Toolkits. This includes PTC Creo Parametric TOOLKIT, J-Link, Web.Link,
and VB API.
If you select J-Link, a directory called jlink is created under the PTC Creo
Parametric loadpoint and J-Link is automatically installed in this directory. This
directory contains all the libraries, example applications, and documentation
specific to J-Link.
Sample Applications
The J-Link sample applications are available in the location <creo_jlink_
loadpoint>/jlink_appls.
Note
You must set the configuration option regen_failure_handling to
resolve_mode in the PTC Creo Parametric session before running the
sample application install_test. From Creo Parametric 2.0 M060
onward, a configuration file (config.pro) has been provided for the
install_test application. The config.pro contains the regen_
failure_handling option.
InstallTest
Location Main Class
<creo_jlink_loadpoint>/jlink_appls/ StartInstallTest
install_test
Note
The java file AsyncInstallTest.java is not compiled because it
is used in the asynchronous mode only. Before compiling, rename this file
to a non-Java file, that is, AsyncInstallTest.bak.
4. Create a config.pro file if you are using Java 1.1. Add the following
line to this file:
jlink_java2 off
Note
For more information on the supported JDK versions for synchronous J-
Link refer to http://www.ptc.com/partners/hardware/
current/jlink.htm.
InstallTest
Location Main Class
<creo_jlink_loadpoint>/jlink_appls/ AsyncInstallTest
install_test
Note
For more information on the supported JDK versions for asynchronous J-
Link and the value of the asynchronous flags refer to http://
www.ptc.com/partners/hardware/current/jlink.htm
jlinkexamples
Location Main Class
<creo_jlink_loadpoint>/jlink_appls/ pfcExamplesMenu.java, however note that
jlinkexamples not all examples may be tied to this class.
jlinkasyncexamples
Location Main Class
<creo_jlink_loadpoint>/jlink_appls/ Many independent examples
jlinkasyncexamples
The parameter editor also supports the following customized types of parameters:
• Using the editor to create parameters with descriptive names (user interface
names) of up to 80 character. The value of the assigned user interface name
will be displayed as the parameter name in the J-Link user interface.
• Creating parameters that obey specific rules:
○ Enumerated lists
The save check example demonstrates a synchronous J-Link utility that presents a
user interface that identifies if any problems exist in the model you are about to
save. If any problems exist in the assigned parameter values or if a material has
not been assigned to a part, the user interface will appear with information about
the problems.
This appendix describes how to control the procedure used by PTC Creo
Parametric to invoke synchronous J-Link applications to enable you to use a non-
default JVM or to debug your applications.
421
Supported Java Virtual Machine Versions
The machine information for the JVM versions supported by J-Link is available
at:
http://www.ptc.com/partners/hardware/current/jlink.htm
The PTC Creo Parametric installation includes a default JVM shipped as a part of
its CD image. For synchronous J-Link applications, PTC Creo Parametric uses the
PTC Creo Parametric-supplied JVM by default.
PTC Creo Parametric includes the ability to override the default JVM command
used to invoke J-Link applications. This allows you to:
• Use a non-standard JVM in your deployment, if that JVM has a feature or a fix
that is necessary for your application to work correctly.
• Apply command line flags to the Java invocation, thus allowing it to be used
for debugging or other customized purposes.
Note
The appropriate flags for synchronous J-Link as well as the flags for the user-
supplied JRE must be used. The synchronous J-Link flags are listed on the J-
Link platform page. It is recommended that you update the version of the JVM
on your machine to the minimum supported version for the platform.
For both running and compiling, the environment variable CLASSPATH must
point to the locations of the application classes and archives.
The CLASSPATH should also include the path to the J-Link asynchronous mode
archive file pfcasync.jar. This archive is located at <creo_loadpoint>\
<datecode>\Common Files\text\java\pfcasync.jar.
This appendix illustrates the relationships between faces, contours, and edges.
Examples E-1 through E-5 show some sample parts and list the information about
their surfaces, faces, contours, and edges.
425
Example 1
Example 2
This part was extruded from a rectangular cross section. The feature on the top
was added later as an extruded protrusion in the shape of a semicircle.
• Face A has 1 contour and 6 edges.
• Face B has 2 contours and 8 edges.
• Face C has 1 contour and 4 edges.
Example 4
This part was extruded from a cross section identical to Face A. In the Sketcher,
the top boundary was sketched with two lines and an arc. The sketch was then
extruded to form the base part, as shown.
Example 5
This part was extruded from a rectangular cross section. The slot and hole features
were added later.
• Face A has 1 contour and 8 edges.
• Face B has 3 contours and 10 edges.
This appendix describes the geometry representations of the data used by J-Link.
429
Surface Parameterization
A surface in PTC Creo Parametric contains data that describes the boundary of the
surface, and a pointer to the primitive surface on which it lies. The primitive
surface is a three-dimensional geometric surface parameterized by two variables
(u and v). The surface boundary consists of closed loops (contours) of edges. Each
edge is attached to two surfaces, and each edge contains the u and v values of the
portion of the boundary that it forms for both surfaces. Surface boundaries are
traversed clockwise around the outside of a surface, so an edge has a direction in
each surface with respect to the direction of traversal.
This section describes the surface parameterization. The surfaces are listed in
order of complexity. For ease of use, the alphabetical listing of the data structures
is as follows:
• Cone on page 432
• Coons Patch on page 435
• Cylinder on page 431
• Cylindrical Spline Surface on page 438
• Fillet Surface on page 435
• General Surface of Revolution on page 433
• NURBS on page 441
• Plane on page 430
• Ruled Surface on page 434
• Spline Surface on page 436
• Tabulated Cylinder on page 434
• Torus on page 432
Plane
The plane entity consists of two perpendicular unit vectors (e1 and e2), the
normal to the plane (e3), and the origin of the plane.
Data Format:
Cylinder
The generating curve of a cone is a line at an angle alpha to the axis of revolution
that intersects the axis at the origin. The v parameter is the height of the point
along the axis, and the radial distance of the point is v * tan(alpha).
Data Format:
e1[3] Unit vector, in the u direction
e2[3] Unit vector, in the v direction
e3[3] Normal to the plane
origin[3] Origin of the cone
alpha Angle between the axis of the cone
and the generating line
Parameterization:
(x, y, z) = v * tan(alpha) * [cos(u) * e1 +
sin(u) * e2] + v * e3 + origin
Torus
The generating curve of a torus is an arc of radius R2 with its center at a distance
R1 from the origin. The starting point of the generating arc is located at a distance
R1 + R2 from the origin, in the direction of the first vector of the local coordinate
system. The radial distance of a point on the torus is R1 + R2 * cos(v), and the
height of the point along the axis of revolution is R2 * sin(v).
Data Format:
e1[3] Unit vector, in the u direction
e2[3] Unit vector, in the v direction
e3[3] Normal to the plane
origin[3] Origin of the torus
radius1 Distance from the center of the
Tabulated Cylinder
Coons Patch
A Coons patch is used to blend surfaces together. For example, you would use a
Coons patch at a corner where three fillets (each of a different radius) meet.
Data Format:
le_curve u = 0 boundary
ri_curve u = 1 boundary
dn_curve v = 0 boundary
up_curve v = 1 boundary
point_matrix[2][2] Corner points
uvder_matrix[2][2] Corner mixed derivatives
Fillet Surface
Spline Surface
The parametric spline surface is a nonuniform bicubic spline surface that passes
through a grid with tangent vectors given at each point. The grid is curvilinear in
uv space. Use this for bicubic blending between corner points.
Data Format:
u_par_arr[] Point parameters, in the u
direction, of size Nu
v_par_arr[] Point parameters, in the v
direction, of size Nv
point_arr[][3] Array of interpolant points, of
size Nu x Nv
u_tan_arr[][3] Array of u tangent vectors
at interpolant points, of size
Nu x Nv
v_tan_arr[][3] Array of v tangent vectors at
interpolant points, of size
Nu x Nv
uvder_arr[][3] Array of mixed derivatives at
interpolant points, of size
NURBS Surface
The NURBS surface is defined by basis functions (in u and v), expandable arrays
of knots, weights, and control points.
Data Format:
deg[2] Degree of the basis
functions (in u and v)
u_par_arr[] Array of knots on the
parameter line u
v_par_arr[] Array of knots on the
parameter line v
wghts[] Array of weights for
rational NURBS, otherwise
NULL
c_point_arr[][3] Array of control points
Definition:
Data Format:
e1[3] x' vector of the local coordinate
system
e2[3] y' vector of the local coordinate
system
e3[3] z' vector of the local coordinate
system, which corresponds to the
axis of revolution of the surface
Line
Data Format:
end1[3] Starting point of the line
end2[3] Ending point of the line
Parameterization:
(x, y, z) = (1 - t) * end1 + t * end2
Arc
The arc entity is defined by a plane in which the arc lies. The arc is centered at the
origin, and is parameterized by the angle of rotation from the first plane unit
vector in the direction of the second plane vector. The start and end angle
parameters of the arc and the radius are also given. The direction of the arc is
counterclockwise if the start angle is less than the end angle, otherwise it is
clockwise.
Data Format:
vector1[3] First vector that defines the
plane of the arc
vector2[3] Second vector that defines the
plane of the arc
origin[3] Origin that defines the plane
of the arc
start_angle Angular parameter of the starting
point
end_angle Angular parameter of the ending
point
radius Radius of the arc.
Parameterization:
t' (the unnormalized parameter) is
(1 - t) * start_angle + t * end_angle
(x, y, z) = radius * [cos(t') * vector1 +
sin(t') * vector2] + origin
Spline
The spline curve entity is a nonuniform cubic spline, defined by a series of three-
dimensional points, tangent vectors at each point, and an array of unnormalized
spline parameters at each point.
NURBS
The NURBS (nonuniform rational B-spline) curve is defined by expandable arrays
of knots, weights, and control points.
Data Format:
degree Degree of the basis function
params[] Array of knots
weights[] Array of weights for rational
NURBS, otherwise NULL.
c_pnts[][3] Array of control points
Definition:
This appendix lists and briefly describes the classes that make up the J-Link
interface.
443
List of J-Link Classes
The following table briefly describes the classes in the J-Link interface.
Class Package Returned by
ActionListener pfcBase Base class; not returned.
This class defines an action listener.
ActionListeners pfcBase ActionListeners.create()
This data type is used to specify a list of action listeners.
ActionSource pfcBase Base class; not returned.
This class specifies an action source.
ActionSources pfcBase ActionSources.create()
This type describes an array of action sources.
AnalysisFeat pfcAnalysisFeat Downcast of
pfcFeature.Feature.
This feature type specifies an analysis feature.
Arc pfcGeometry Downcast of
pfcGeometry.Curve.
This class defines an arc.
AreaNibbleFeat pfcAreaNibbleFeat Downcast of
pfcFeature.Feature.
This feature type specifies a nibble area. This feature type is used in sheetmetal applications.
Arrow pfcGeometry Downcast of
pfcGeometry.Curve.
This class defines an arrow.
Assembly pfcAssembly Session.CreateAssem
bly()
,
ComponentPath.GetRoot()
This class describes an assembly.
AssemblyCutCopyFeat pfcAssemblyCutCopyFeat Downcast of
pfcFeature.Feature.
This feature type specifies a cut and copied feature, which is used in the Assembly Design module.
AssemblyCutFeat pfcAssemblyCutFeat Downcast of
pfcFeature.Feature.
This feature type specifies a cutout feature, which is used in the Assembly Design module.
AttachFeat pfcAttachFeat Downcast of
pfcFeature.Feature.
This feature type specifies an attached feature.
AttachVolumeFeat pfcAttachVolumeFeat Downcast of
pfcFeature.Feature.
This feature type specifies an attached volume.
AuxiliaryFeat pfcAuxiliaryFeat Downcast of
pfcFeature.Feature.
This feature type specifies an auxiliary feature.
Axis pfcGeometry Downcast of
pfcModelItem.ModelItem.
This class defines an axis.
This enumerated type lists the possible starting points of the datum curve offset.
CurveXYZData pfcGeometry GeomCurve.Eval3DData(),
GeomCurve.EvalFrom
Length()
This feature type specifies a populate feature, which is used in the PTC Creo NC Sheetmetal module.
SheetmetalPunchPoint pfcSheetmetalPunch Downcast of
Feat PointFeat pfcFeature.Feature.
This feature type specifies a punch point, which is used in the PTC Creo NC Sheetmetal module.
SheetmetalShearFeat pfcSheetmetalShearFeat Downcast of
pfcFeature.Feature.
This feature type specifies a sheetmetal shear feature.
SheetmetalZoneFeat pfcSheetmetalZone Downcast of
Feat pfcFeature.Feature.
This feature type specifies a sheetmetal zone.
ShellFeat pfcShellFeat Downcast of
pfcFeature.Feature.
This feature type specifies a shell.
ShrinkageFeat pfcShrinkageFeat Downcast of
473
C window, 201
Coordinate transformations, 200
catch keyword, 27
Copy
Cells
models, 116
accessing, 288
Create
Children, 214
action listeners, 292
cipjava, 43
applications, 43
Circles, 243
assembly, 176
Classes
buttons, 98
list of, 444
family table columns, 289
types, 32
family table instance, 286
Clear
layer, 210
window, 197
local group, 218
Close
material, 187
window, 197
menus, 98
Colors, 68
parameters, 257
Commands
part, 176
designating, 102
simplified representations, 348
Comments, 28
UDFs, 222
Composite curves
window, 196
description, 243
Create Interactively Defined UDFs,
Cones
223
class representation, 247
Creating UDFs, 222
geometry representation, 432
Curves, 243
Configuration file
data structures, 439
protkdat option, 18
determining the type, 243
toolkit_registry_file option, 18
t parameter, 243
Configuration options, 67
types, 243
Contours
reserved, 243
evaluating, 246
Cylinders, 247
traversing, 242
geometry representation, 431
Contours, locating in a model, 246
spline surfaces, 438
Coons patches
tabulated, 247
geometry representation, 435
geometry representation, 434
Coordinate systems, 250
assemblies, 202
datum, 202 D
drawing, 202
Data types, 27
Drawing View, 202
enums, 38
evaluating, 250
delay_start field, 16
screen, 201
Delete
section, 202
feature pattern, 218
solid, 201
Index 475
files, 302 geometry representation, 435
final keyword, 26
finally keyword, 27
F
Find
Faces APIWizard search mechanism, 61
traversing, 242 FocusListener, 27
Family tables, 286 Frames
cells, 288 display frame in APIWizard, 60
columns topic/object selection, 59
accessing, 287
instances
accessing, 286 G
symbols, 287 Garbage collection, 24
Features General surface of revolution, 433
accessing, 214 Generic model
creating, 215 getting, 286
failed, 214 Geometry
groups, 214, 218 solid edge, 245
identifiers, 214 terms, 242
information, 214 traversal, 242
operations, 215 Groups, 218, 221
parents, 214
patterns, 218
H
read-only, 214
resuming, 215 Hierarchy
suppressing, 215 application, 43
user-defined, 221 Highlight
Fields selections, 82
of ActionListeners, 40
of arrays, 37 I
of enumerated types, 39
of PTC Creo Parametric-related Implementation
objects, 34 and inheritance, 24
of sequences, 36 Import
of utilities, 42 packages, 43
Files Information
exporting, 302 Drawing, 125
JAR, 20 Inheritance
message, 69 of ActionListeners, 41
contents, 70 of arrays, 38
naming restrictions, 69 of enumerated types, 39
plotting, 333 of PTC Creo Parametric-related
Fillet surfaces objects, 33, 35
Index 477
of children, 214 running, 20
of current windows, 196 ModelItems
of layer items, 210 duplicating, 210
of materials, 187 evaluating, 250
of ModelItems, 208 getting, 208
of pattern members, 214, 218 information, 209
of rows in a family table, 286 types, 208
of subitems, 208 Models
of views, 199 descriptors, 110
of windows, 196 Drawing
Local groups Obtaining, 124
creating, 218 exporting, 302
Locks, 286 getting, 110
operations, 116
retrieving, 112
M
Modify
Machines simplified representations, 349
setting up, 16
Macros, 67
Mass properties, 185
N
Materials, 187 name field, 16
Matrix native keyword, 27
code example, 205 new keyword, 26
Matrix3D object, 205 Normalize
Message files, 69 matrix, 205
contents, 70 Notification of events, 27
restrictions, 69 NURBS
Message window representation, 441
reading from, 71 surface, 437
writing to, 71
Methods
O
of ActionListeners, 41
of arrays, 37 Objects
of dictionaries, 39 browsing with APIWizard, 60
of PTC Creo Parametric-related Open
objects, 33-34 file, 112
of sequences, 36 Operations
of utilities, 42 Drawing, 125
overloading and overriding, 24 feature, 215
starting and stopping, 21 layer, 210
Model programs, 19 model, 116
definition, 19 solid, 177, 342
view, 200
Index 479
simplified representations, 347 accuracy, 176
view, 199 coordinate system, 201
Revolved surfaces, 247 geometry traversal, 208
Rotate getting a solid object, 176
view, 200 information, 176
Ruled surfaces, 247 mass properties, 185
geometry representation, 434 operations, 177, 342
Run Splines
applications, 19 cylindrical spline surface, 438
model program, 20 description, 243
representation, 440
surface, 436
S
Standalone applications, 16
Save Start method, 21
models, 116 startup field, 16
view, 200 static keyword, 26
Screen coordinate system, 201 Status
Search feature, 214
APIWizard search mechanism, 61 layer, 210
using the APIWizard, 61 Stop method, 21
Selection, 80 Strings, 27
accessing data, 81 Surfaces, 247
controlling display, 82 cylindrical spline, 438
Sequences, 35 data structures, 430
sample class, 36 evaluating, 249
Set up area, 249
applications, 16 evaluating parameters, 249
machine, 16 fillet
model programs, 19 geometry representation, 435
Sheets general surface of revolution, 433
Drawing, 127 NURBS
Simplified representations geometry representation, 437
adding items, 349 revolved, 247
creating, 348 ruled, 247, 434
deleting, 348 spline, 436
items, 349 traversing, 242
extracting information from, 348 types, 247
modifying, 349 UV parameterization, 247
retrieving
geometry, 347
graphics, 347
T
utilities, 350 t parameter
Solids
Index 481