UG Import
UG Import
Purpose
The purpose of this lesson is to import native NX files and other related data
into Teamcenter Engineering.
Objectives
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-1
NX Integration Import and Data Release
• A mapping file is typically used to provide settings for the many options.
16-2 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Wheel Assembly
The wheel assembly below contains the components as listed in the Assembly
Navigator.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-3
NX Integration Import and Data Release
Frame Assembly
The frame assembly below contains the components as listed in the Assembly
Navigator.
16-4 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
• Assemblies
Because ug_import works slightly different for these file types, you must
ask these questions:
• What setup requirements are there?
1400_wheel_000.prt
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-5
NX Integration Import and Data Release
The directory below must be divided into the categories shown in order to
properly use ug_import and its arguments.
1300_bearing_000.prt
1400_wheel_000.prt
The ug_import utility essentially works the same for component and assembly
parts, but the utility performs a database login each time it is executed. The
login can take a fair amount of time. Therefore, preferably you would like to
know the assembly parts and execute ug_import on the top level assemblies.
The NX utility ugpc can be run on the part (.prt) files in
the directory to get a output listing of the assemblies
and their components, as shown in the following example.
1600_wheel_assy_000.prt
./1250_axle_000.prt
./1700_spacer_000.prt
./1300_bearing_000.prt
./1400_wheel_000.prt
As you will see the components and assembly master files can be imported
with one command line ug_import execution and a mapping file to convert all
files to the proper database Part ID and Revision.
16-6 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
1250_axle_000.tif
Next begin to recognize the files associated to the components and assemblies.
These files would be like TIF or HTML files.
These files can be placed in an individual directory and imported with one
extra argument on the command line or one extra keyword in a mapping file.
For example, you could simply use:
1250_axle_000_dwg.prt
Next recognize the non-master part files that work with the component and
assemblies. These files would be drawings and manufacturing part (.prt) files.
Non-master part files can reside in the same directory as their master part
files, but must be imported with their own ug_import execution.
For these part files you must specify the relation to the master part (e.g.
specification, manifestation, etc.) and the name of the UGPART dataset
created with the import.
For example, you could simply use:
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-7
NX Integration Import and Data Release
Next begin to recognize the files associated to the non-master part files (e.g.,
CLSF, PTP files). These files would be like CGM files that are associated to a
drawing or the common CAM related files for manufacturing operations.
Like before, these files can be placed in an individual directory and imported
with one extra argument on the command line or one extra keyword in a
mapping file.
For example, you could simply use:
Non-NX Files
Finally importing the non-NX files can easily be done by importing the files
into the Item or Item Revision with the import_file utility. This utility was
used earlier in the course.
Product or part attributes may exist in the part file or inside another
application (e.g. MRP). Importing NX part attributes is done automatically
with the ug_import utility, after a preference is setup with the list of attribute
names. Importing attributes from other applications usually requires
exporting the attributes to a neutral file and then using a custom Teamcenter
Engineering program to import the attributes into the database.
16-8 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
1400_wheel_000.prt
1400_wheel_000.prt
As you can see the master part files for the 1600_wheel_assy_000.prt and the
seed parts still remain in their original directories. The non-master part file
(1250_axle_000_dwg.prt) and the non-NX file (m243_heat_treat.txt) also
remain in the original directory.
To convert the files names to database Part IDs and Revisions, the
1600_wheel_assy.map file has been added and will be used during the import.
Also the 1600_search.txt file has been added to locate the 1400_wheel_000.prt.
Two sub-directories have been created for the associated files. The
sub-directory contents are shown below.
1250/
1250_axle_000.tif
1250_axle_000_dwg/
1250_000_dwg.cgm
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-9
NX Integration Import and Data Release
The ug_import utility takes your standard NX assembly and recreates both
the parts and the structure in Teamcenter Engineering. For each NX part,
ug_import creates items, item revisions and datasets as necessary.
The simplest import is carried out by specifying the command:
ug_import -part=1600_wheel_assy_000.prt
ug_import -part=/users/daytr/1600_wheel_assy_000.prt
16-10 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
A mapping file can set the individual components without affecting other
components in the assembly.
[CA_36245.prt]
db_part_no="CA_36245_000"
db_part_rev="000"
assoc_files=yes
assoc_files_dir="CA_36245_files"
[ENG_83475.prt]
existing_data=$OVERWRITE_EXISTING
db_part_no="ENG_83475_000"
db_part_rev="000"
assoc_files=no
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-11
NX Integration Import and Data Release
Depending on the command line keyword the entire assembly or just the
top part of the assembly are affected.
The details of these will be explained on later pages by using real world
examples.
Your site may not keep all the components of all assemblies in the same
directory. If you specify the name of a search list file on the command line,
NX Integration searches the directories listed in the search list file for the
component parts of the assembly.
You may have other files that are used with your part files (e.g. machining
operation files).
In addition to importing part files, you can import other types of NX files
associated with a part file from operating system directories.
16-12 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
[-dryrun]
[-id=<Item ID>]
[-rev=<Item Revision>]
[-import_folder=<folder name>]
[-type=<relationship type>]
[-name=<dataset name>]
[-assoc_files=<yes/no>]
[-assoc_root_dir=<associated files root dir>]
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-13
NX Integration Import and Data Release
KEYWORD VALUE
-part= The operating system pathname of
the top level part in the NX assembly
which is to be imported.
-dryrun Indicates whether the import will
proceed as expected, without actually
doing the import.
-id= The Item ID which is given to the
standard NX part specified on the
command line.
-rev= The Teamcenter Engineering revision
which is given to the standard NX part
specified on the command line.
-import_folder= The name of the Teamcenter
Engineering folder which stores the
imported assembly and all of its
components.
KEYWORD VALUE
-mapping= The operating system pathname of the
file containing details of the way in
which individual components in your
assembly should be imported.
-search= The operating system pathname
of the file which lists operating
system directories to search for the
components of your assembly.
16-14 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
KEYWORD VALUE
-type= The type of non-master part file created
in Teamcenter Engineering.
-name= The name of the non-master part file
created in Teamcenter Engineering.
KEYWORD VALUE
-assoc_files= Used to instruct ug_import whether
to import files associated with the
specified assembly and all of its
components.
-assoc_root_dir= The operating system directory under
which sub-directories containing
associated files belonging to the
assembly and all of its components are
located.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-15
NX Integration Import and Data Release
If you have any characters other than letters, digits, underscores, and
hyphens in the value that you specify for a particular keyword, it is
recommended that you enclose the value in quotation marks "" to avoid
import errors. For example, if you wish to import the part "chassis.prt" into a
folder in Teamcenter Engineering called "Concept Car" (note the space in the
folder name), it is advisable to specify the command:
ug_import -part=chassis.prt -import_folder="Concept Car"
There is a maximum length limit for the values corresponding to some of the
keywords used by ug_import.
Login Keywords
If you have autologin enabled, -part= is the only keyword that must be
specified on the command line. All the other keywords listed in the table are
optional. However, if autologin is disabled the -u= and -p= keywords are
also required. For example,
ug_import -part=1400_wheel_000.prt -u=<user> -p=<password>
16-16 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
• The top part in the assembly is overwritten, but any component parts
which already exist in the database are not overwritten.
• In order to change the default import behavior for the component parts,
you must specify a mapping file. Therefore assemblies will most likely
be imported with a mapping file.
The -part= keyword specifies the operating system pathname of the top part
in the NX assembly which is to be imported into Teamcenter Engineering.
Both master and non-master part files can be imported.
You must always specify the full pathname of the operating system part
file corresponding to the top level part in your assembly on the ug_import
command line unless the part is located in your current directory. For
example,
ug_import -part=/users/daytr/parts/1600_wheel_assy_000.prt
• –rev=
The -id= and -rev= keywords can be used to import the part specified on the
command line (only) with a different part number and revision respectively.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-17
NX Integration Import and Data Release
Note that the -import_folder= keyword causes the assembly and all of its
components to be imported into the specified folder. If you wish individual
components in the assembly to be imported into different folders, you must
specify the -import_folder directive in a mapping file instead.
The -dryrun keyword allows you to see whether your import will progress
as you expect. It runs through the import procedure without actually
importing any parts into the Teamcenter Engineering database. The normal
ug_import messages are displayed, allowing you to check whether there will
be any errors when you do import the assembly, and to correct them before
proceeding.
The -dryrun keyword is particularly useful if you intend to import a large
assembly because the import checks are performed much faster than a full
import.
16-18 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Scenario
In this scenario, a Wheel Assembly will be imported. A map file will be used
to convert all the part file names to their database part ID. Additionally a
search file will be used, since the parts are in various directories.
ug_import -part=1600_wheel_assy_000.prt -search=1600_search.txt
-mapping=1600_wheel_assy.map [-dryrun]
Search-List File
A search-list file is a text file which lists the operating system directories
which ug_import should search in order to locate the part files corresponding
to component parts in an assembly. The filename of a search-list file is
specified on the ug_import command line using the -search= keyword. For
example,
ug_import -part=1600_wheel_assy_000.prt
-search=1600_search.txt
You need to provide a search-list file if any part files corresponding to the
components of your assembly are located in different directories from the part
file which stores the top part in the assembly.
A search-list file simply lists the operating system directories which should be
searched to locate the component files of the assembly. Each directory should
be specified on a new line. If a directory name ends in "/...", all directories
beneath the specified directory also are searched.
For example, a search-list file with the contents:
.
/iman/daytr/v5_sitea/ug_import_files/...
/iman/class-default/v5_sitea_parts
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-19
NX Integration Import and Data Release
Mapping Files
A mapping file is an optional file that may be specified for the import utility.
The purpose of a mapping file is to allow you to specify exactly how individual
components in an assembly are imported into Teamcenter Engineering.
[SECTION_NAME]
KEYWORD=VALUE
KEYWORD=VALUE
[Defaults]
import_folder = "Import Folder"
db_part_no=$STRIPPED_LEAFNAME
existing_data=$USE_EXISTING
[CA_36245.prt]
db_part_no="CA_36245_000"
db_part_rev="000"
[ENG_83475.prt]
existing_data=$OVERWRITE_EXISTING
db_part_no="ENG_83475_000"
db_part_rev="000"
16-20 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Key Points
There are a few general points to note when using mapping files:
• An exclamation mark (!) at the beginning of a line specifies the line as
a comment line.
• If you wish to include spaces in a field, then you must enclose the field
in double quotes.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-21
NX Integration Import and Data Release
Keyword: db_part_no
Description: Teamcenter Engineering part (Item) ID
Valid Expression: $STRIPPED_LEAFNAME
$EXPORTED_PART_NO
Default: If the part has been previously exported
from NX Integration, defaults to the value it
had when exported. Otherwise, defaults to
$STRIPPED_LEAFNAME
Keyword: db_part_rev
Description: Teamcenter Engineering part revision
Valid Expression: $EXPORTED_PART_REV
Default: Defaults to A
Keyword: db_part_name
Description: Teamcenter Engineering part name
Valid Expression: $STRIPPED_LEAFNAME
$IMPORTED_PART_NO
Default: If the part has been previously exported from NX
Integration, defaults to the value it had when
exported. Otherwise, defaults to the same value as
db_part_no.
Keyword: db_part_desc
Description: Teamcenter Engineering part description
Valid Expression:
Default: Defaults to the same value as db_part_no, if
specified in a mapping file. Otherwise, defaults
to $STRIPPED_LEAFNAME (the file name of the
UG part without the leading directory and the .prt
extension).
16-22 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Keyword: import_folder
Description: Teamcenter Engineering folder where imported
parts are placed.
Valid Expression: $DEFAULT_IMPORT_FOLDER
Default: Your Newstuff folder. Note that -import_folder
specified on the command line takes precedence over
import_folder specified in a mapping file.
Keyword: existing_data
Description: What to do if parts already exist in Teamcenter
Engineering
Valid Expression: $FAIL_IF_PART_EXISTS
$FAIL_IF_REV_EXISTS
$OVERWRITE_EXISTING
$USE_EXISTING
Default: Overwrite the existing top part (only) in the
assembly, $OVERWRITE_EXISTING.
For all the component parts in the assembly, use
the existing data $USE_EXISTING.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-23
NX Integration Import and Data Release
16-24 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Part # 2, [/users/legacy/ug_import_files/1250_axle_000.prt]
Teamcenter Integration for NX part number [1250/000] already exists.
Using the existing copy.
Existing part type [Item] will be retained.
Part # 3, [/users/legacy/ug_import_files/1300_bearing_000.prt]
Teamcenter Integration for NX part number is [1300/000] in folder [Newstuff]
Part will be created with type [Item].
Part # 4, [/users/legacy/ug_import_files/1400_wheel_000.prt]
Teamcenter Integration for NX part number is [1400/000] in folder [Newstuff]
Part will be created with type [Item].
Part # 5, [/users/legacy/ug_import_files/1700_spacer_000.prt]
Teamcenter Integration for NXpart number is [1700/000] in folder [Newstuff]
Part will be created with type [Item].
Creating 1600/000
Creating 1300/000
Creating 1400/000
Creating 1700/000
Starting Save.............
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-25
NX Integration Import and Data Release
In this activity, you will use ug_import to import an assembly part file and its
components into the database. You will use a mapping file to convert the part
file names to appropriate part numbers.
Step 1: Import the 1600 Wheel Assembly.
Continue to work from the Teamcenter Engineering
environment command window and the ug_import_files
directory.
16-26 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Scenario
Explanation
KEYWORD VALUE
-id= The item ID of the master part
file which the non-master part
file is to belong to.
-rev= The item revision which is given
to your imported non-master
part file.
-type= The type of non-master part file.
This may be: specification (or
spec for short) ,or manifestation
(man for short).
-name= The name of the specification or
manifestation.
The keywords -id and -type must both be present for new non-master parts.
The -rev and -name keywords are optional, but are commonly used to provide
specific part revision and non-master dataset name.
Note that if -rev is omitted, and the revision is not specified in a mapping file,
the configured revision (according to the default configuration rule) is used. If
there is no configured revision, then revision "A" is used.
If the -name keyword is absent from the command line, the name of the
dataset defaults to the "stripped leafname" of the top part of the assembly.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-27
NX Integration Import and Data Release
16-28 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Choose File→Open...
Choose OK.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-29
NX Integration Import and Data Release
Explanation
The ug_import utility allows you to import dependent files that are associated
with both master and non-master part files. In this case dependent files
will be imported as named references into the 1250/000 UGMASTER. The
-mapping is used to map the Axle name of the 1250 part.
KEYWORD VALUE
-assoc_files Used to instruct ug_import whether
to import associated files belonging to
the specified part and associated files
belonging to all of its components. The
value must be "yes" or "no".
-assoc_root_dir Specifies the root directory under
which sub-directories containing the
associated files belonging to all parts
in the specified assembly are located.
The directory must already exist.
16-30 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
part specified on the command line, and the associated files belonging to each
of its components. The associated files are imported from sub-directories
beneath the directory specified by -assoc_root_dir.
If the specified associated files directory cannot be located, the import is
aborted.
Sub-directory Example
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-31
NX Integration Import and Data Release
In this activity, you will use the ug_import utility to import the 1250.tif file
associated to the 1250 Axle. This part was imported in the previous activity
with the 1600 Wheel Assembly.
Step 1: Import the 1250 Axle Associated files.
Continue working from Teamcenter Engineering environment
command window and the ug_import_files directory.
16-32 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Scenario
In this scenario, some files that are associated to drawings will be imported.
To import the files associated to a non-master part file the following ug_import
arguments will be used. What does this usage do?
ug_import -part=1250_axle_a.prt -id=1250 -rev=000
-name=1250_DWG -type=manifestation -assoc_files=yes
Explanation
The ug_import utility allows you to import dependent files that are associated
with non-master part files. In this case dependent files will be imported as
named references into the 1250_DWG UGPART.
Sub-directory Example
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-33
NX Integration Import and Data Release
In this activity, you will use the ug_import utility to import the
1250_000_dwg.cgm file associated to the 1250 Axle Drawing.
Step 1: Import the 1250 Axle Drawing Associated files.
Continue working in command window.
16-34 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
Scenario 6
In this scenario, all the part files (master, non-master, and associated) will
be imported. To import all these files the following ug_import commands
will be used.
The one map file will control the parameters for all these part files:
• components
• assemblies
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-35
NX Integration Import and Data Release
These KEYWORDs are used in the mapping file to control the Part ID,
Revision, Part Name, and Part Description for the Item, Item Revision, and
UGMASTER created during the import.
These KEYWORDs are used in the mapping file to control the name of the
UGPART (non-master) and determine the placement of the UGPART inside
the Item Revision (e.g. Specification, Manifestation relation).
16-36 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
These KEYWORDs are used in the mapping file to control the import of
associated files (e.g. TIF, CGM, HTML, and other NX files). Specifying
assoc_files=yes will cause ug_import to import files into the UGMASTER or
UGPART as additional named references.
These general purposed KEYWORDs are used in the mapping file to control
what folder imported parts are put into and whether components are
overridden.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-37
NX Integration Import and Data Release
Below is an example map file. This mapping file will specify the ID and
Revision for the components but will also state the Model Type, Model Name,
and whether the part has Associated Files.
[Defaults]
existing_data=$USE_EXISTING
import_folder="2105 Assembly"
assoc_files=no
[2105_000.prt]
db_part_id=2105
db_part_name="Skate Assembly"
db_part_rev=000
[1101_000.prt]
db_part_id=1101
db_part_name="Wheel Assembly"
db_part_rev=000
assoc_files=yes
[1150_000.prt]
db_part_id=1150
db_part_name="Axle"
db_part_rev=000
[1113_000.prt]
db_part_id=1113
db_part_name="Hub"
db_part_rev=000
[1110_000.prt]
db_part_id=1110
db_part_name="Wheel"
db_part_rev=000
[2111_000.prt]
db_part_id=2111
db_part_name="Frame"
db_part_rev=000
assoc_files=yes
[2111_000_dwg.prt]
db_part_id=2111
db_part_rev=000
db_model_type=manifestation
db_model_name=2111_DWG
assoc_files=yes
[2111_000_nc.prt]
db_part_id=2111
db_part_rev=000
db_model_type=manifestation
db_model_name=2111_CAM
assoc_files=yes
16-38 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
After reviewing the script, exit the text editor without saving.
Choose File→Open...
Choose OK.
The 2105 Frame Assembly loads into the graphics window.
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-39
NX Integration Import and Data Release
Choose OK.
The frame drawing loads into the graphics window.
16-40 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
• dataset information
The latter is new in this class for the use of import_file. In supplying the
Item information, a Dataset and Item will be created and the dataset will be
placed inside the Item.
In practice this utility is used:
1. To import files into Teamcenter Engineering just as datasets (as seem
in a previous lesson).
IMAN_ROOT/bin/import_file -f=<filename>
-type=<datasettype> -d=<dataset_name>
-ref=<named_reference> [-item=<item_id>]
[-revision=<item_rev>] [-ie={n | y}] [-log=<file>]
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-41
NX Integration Import and Data Release
In this activity, you will use the import_file utility to import a text file into the
database to be a reference of the 1250 Axle part.
Step 1: Import the m243_heat_treat.txt text file.
In the command window, change back to the ug_import_files
directory located in the aa_class directory.
16-42 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-43
NX Integration Import and Data Release
In this activity, you will use the Import Release process template to release
some of your previously imported data.
Step 1: Initiate the 2111 Frame ItemRevision.
If necessary, expand the 2105 Assembly folder.
Choose File→New→Process...
The New Process dialog appears. The Process Name defaults
to the object name.
Choose OK.
Step 2: Review the data from your Inbox and perform the signoff.
16-44 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007
NX Integration Import and Data Release
©UGS Corp., All Rights Reserved Teamcenter Engineering Application Administration 16-45
NX Integration Import and Data Release
Summary
In this lesson you:
• Imported NX Data into the Database
16-46 Teamcenter Engineering Application Administration ©UGS Corp., All Rights Reserved MT14350-S-2007