NXOpen .NET Reference Guide  1899
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Types | Public Member Functions | Protected Member Functions | List of all members
NXOpen.PDM.FileManagement Class Reference

This class is responsible for Teamcenter file management related activities. More...

Inheritance diagram for NXOpen.PDM.FileManagement:
NXOpen.TransientObject NXOpen.Utilities.NXRemotableObject IDisposable IMessageSink

Public Types

enum  FileType {
  CmmDmi, CpdFeaturePart, CpdGeometryOverride, DirectModel,
  Excel, ExcelX, Image, Jpeg,
  NxDesignatorAssignmentsFile, NxAttachedPart, NxPart, NxPosBin,
  NxleSymbolXml, NxleSymbolPreview, Preview2d, Preview3d,
  QafBinary, QafText, RoutePipeRun, RoutePipeSpec,
  RoutePipeRunAttachment, Text, Tif, TrushapeData,
  ValidationRuleSet
}
 PDM file types More...
 

Public Member Functions

unsafe int[] DeleteAttachedFiles (NXOpen.NXObject[] associatedObject, string[] associationTypeName, string[] datasetTypeName, string[] datasetName, string[] namedReferenceName, string[] isText, string[] logicalFileName, bool keepEmptyDataset)
 Delete Attached Files From Teamcenter. More...
 
unsafe int[] DeleteExistingAttachedFiles (NXOpen.PDM.PdmFile[] files, bool keepEmptyDataset)
 Delete Attached Files From Teamcenter. More...
 
unsafe void DownloadAssociatedFiles (NXOpen.BasePart[] parts, NXOpen.PDM.PdmFile[] files)
 Download the specified named reference files for NX use. More...
 
unsafe int[] ExportFiles (string[] itemIds, string[] itemRevisionIds, string[] datasetNames, string[] datasetTypeNames, string[] datasetRelationTypeNames, string[] baseDirectoryNames, string[] toolNames, out string[] exportDirectoryNames)
 Exports all associated files for the specified dataset(s) to a directory. More...
 
unsafe void ExportNamedReferences (string itemId, string itemRevisionId, string datasetName, string datasetTypeName, string datasetRelationTypeName, string datasetNamedReference, string exportDirectoryName, out string[] namedReferences)
 Export Named Reference From Teamcenter. More...
 
unsafe int[] ExportNamedReferences (string[] itemIds, string[] itemRevisionIds, string[] datasetNames, string[] datasetTypeNames, string[] datasetRelationTypeNames, string[] datasetNamedReferences, string exportDirectoryName, out int[] numNamedReferences, out string[] namedReferences)
 Export Named Reference From Teamcenter. More...
 
unsafe NXOpen.PDM.PdmFile[] GetAssociatedFiles (NXOpen.BasePart[] parts, NXOpen.PDM.FileManagement.FileType[] fileTypesToExclude)
 Given an NX part, this method will return a list of named reference files in the corresponding Teamcenter dataset. More...
 
unsafe int[] GetAttachedFiles (NXOpen.NXObject[] associatedObject, string[] associationTypeName, string[] datasetTypeName, string[] datasetName, string[] namedReferenceName, string[] isText, string[] logicalFileName, string exportDirectoryName, out int[] numOutputFiles, out NXOpen.PDM.PdmFile[] files)
 Get Attached Files Information From Teamcenter. More...
 
unsafe int[] ImportFiles (string[] itemIds, string[] itemRevisionIds, string[] datasetNames, string[] datasetTypeNames, string[] datasetRelationTypeNames, string[] importDirectoryNames)
 Imports all associated files for the specified dataset(s) into the Teamcenter database. More...
 
unsafe int[] ImportFilesAndCreateDatasets (string[] itemIds, string[] itemRevisionIds, string[] datasetNames, string[] datasetTypeNames, string[] datasetRelationTypeNames, string[] datasetToolNames, bool[] fileType, string[] namedReferenceNames, string[] importFileNames, string[] importFileDirectoryNames)
 Import files and create datasets in Teamcenter. More...
 
unsafe int[] SaveAttachedFiles (NXOpen.NXObject[] associatedObject, string[] associationTypeName, string[] datasetTypeName, string[] datasetName, int[] numDatasetPropertyInput, string[] datasetPropertyNames, string[] datasetPropertyValues, NXOpen.NXObject[] ownershipToMatchForNewDataset, NXOpen.PDM.PdmFile[] fileVolumeToStore, string[] toolUsed, string[] datasetDescription, bool[] alwaysCreateNewDataset, bool[] createNewDatasetVersion, bool[] refreshInSessionLoadedLMD, int[] numNamedReferencesPerInput, string[] namedReferenceName, bool[] isText, string[] filePath, string[] logicalFileName, bool[] allowReplace, bool outputFiles, out NXOpen.PDM.PdmFile[] files)
 Save Attached Files To Teamcenter. More...
 
- Public Member Functions inherited from NXOpen.TransientObject
void Dispose ()
 Frees the object from memory. More...
 
void PrintTestData (String variableName)
 <exclude> More...
 
void PrintTestData (String variableName, int lineNumber)
 <exclude> More...
 
new string ToString ()
 Returns a String that represents the current Object. More...
 
- Public Member Functions inherited from NXOpen.Utilities.NXRemotableObject
IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
 Asynchronously processes the given message. More...
 
IMessage SyncProcessMessage (IMessage msg)
 Synchronously processes the given message. More...
 

Protected Member Functions

override void FreeResource ()
 Frees the object from memory. More...
 

Additional Inherited Members

- Properties inherited from NXOpen.TransientObject
IntPtr Handle [get]
 Handle of the internal object represented by this object. More...
 

Detailed Description

This class is responsible for Teamcenter file management related activities.

Use PDM.PdmSession.NewFileManagement to get the instance of this class.

Created in NX6.0.3

Member Enumeration Documentation

PDM file types

Enumerator
CmmDmi 
CpdFeaturePart 
CpdGeometryOverride 
DirectModel 
Excel 
ExcelX 
Image 
Jpeg 
NxDesignatorAssignmentsFile 
NxAttachedPart 
NxPart 
NxPosBin 
NxleSymbolXml 
NxleSymbolPreview 
Preview2d 
Preview3d 
QafBinary 
QafText 
RoutePipeRun 
RoutePipeSpec 
RoutePipeRunAttachment 
Text 
Tif 
TrushapeData 
ValidationRuleSet 

Member Function Documentation

unsafe int [] NXOpen.PDM.FileManagement.DeleteAttachedFiles ( NXOpen.NXObject[]  associatedObject,
string[]  associationTypeName,
string[]  datasetTypeName,
string[]  datasetName,
string[]  namedReferenceName,
string[]  isText,
string[]  logicalFileName,
bool  keepEmptyDataset 
)
inline

Delete Attached Files From Teamcenter.

Delete attached files from dataset. . associatedObject - Teamcenter object the files are attached to; only Parts or Design Elements are supported . associationTypeName - Teamcenter relation type name . datasetTypeName - Teamcenter dataset type name . datasetName - Dataset name for creation or for matching existing dataset . namedReferenceName - Named reference name . isText - Named reference isText flag . logicalFileName - Named reference logical filename . keepEmptyDataset - Flag indicating if datasets should be kept even if they become empty

Created in NX1872.0.0

License requirements: None.

Parameters
associatedObjectTeamcenter object the files are attached to
associationTypeNameTeamcenter relation type name or property name if association is through property
datasetTypeNameTeamcenter dataset type name
datasetNameDataset name for creation or for matching existing dataset
namedReferenceNameNamed reference name
isTextNamed reference isText flag
logicalFileNameNamed reference logical filename
keepEmptyDatasetTrue (default) - keep dataset even if empty; False - don'e keep empty dataset
Returns
Result codes. Success (0), failure (non-zero).
unsafe int [] NXOpen.PDM.FileManagement.DeleteExistingAttachedFiles ( NXOpen.PDM.PdmFile[]  files,
bool  keepEmptyDataset 
)
inline

Delete Attached Files From Teamcenter.

Delete given attached files from dataset.

Created in NX1872.0.0

License requirements: None.

Parameters
filesFiles to delete
keepEmptyDatasetTrue (default) - keep dataset even if empty; False - don'e keep empty dataset
Returns
Result codes. Success (0), failure (non-zero).
unsafe void NXOpen.PDM.FileManagement.DownloadAssociatedFiles ( NXOpen.BasePart[]  parts,
NXOpen.PDM.PdmFile[]  files 
)
inline

Download the specified named reference files for NX use.

Created in NX11.0.0

License requirements: None.

Parameters
parts
files
unsafe int [] NXOpen.PDM.FileManagement.ExportFiles ( string[]  itemIds,
string[]  itemRevisionIds,
string[]  datasetNames,
string[]  datasetTypeNames,
string[]  datasetRelationTypeNames,
string[]  baseDirectoryNames,
string[]  toolNames,
out string[]  exportDirectoryNames 
)
inline

Exports all associated files for the specified dataset(s) to a directory.

The dataset(s) are identified by their Teamcenter item id, Teamcenter item revision id, Teamcenter dataset name, NX dataset type, and NX dataset relation type. A base export directory name must be specified for each dataset along with the tool name that is requesting the export. The full path to the exported files is returned in an output array. The full path will be NX_default_directory or export_directory. Additionally, an array of PDI result codes is returned indicating the success (0) or failure (non-zero) of each export. The dataset types for FOREIGN_MODEL are the ones included in the Teamcenter preference "TC_NX_Foreign_Datasets". In such a case the input relation type should be "Foreign". The exporting of the associated file is governed by following conditions: The associated filetype should be exportable for combination of the Tool used and the Open action for operation. The associated file should not be in the excluded named reference list. For Foreign Datasets it will not export file types included in the Teamcenter preference "TC_NX_Foreign_Datasets". In case of NX CAM dataset type like "UGCAMCLSF", "UGCAMPTP", "UGCAMShopDoc", all the associated files will be exported irrespective of above conditions.

  1. Excluded Named Reference List:
  2. "UGPART"
  3. "UGPART-MASSPR
  4. "UGPART-BBOX
  5. "UGPART-ATTRIBUTES
  6. "UGPART-ATTR
  7. "Trushape-Data
  8. "BVRSYNCINFO
  9. "UG-QuickAccess-Binary
  10. "UG-QuickAccess-Text
  1. NX dataset types and relation names
  2. NX Model Type NX Relation Type NX Dataset Type
  3. MASTER_MODEL "has shape" "UGMASTER"
  4. SPEC_MODEL "has specification" "UGPART"
  5. MAN_MODEL "has manifestation" "UGPART"
  6. ALTREP_MODEL "has altrep" "UGALTREP"
  7. SCENARIO_MODEL "UG_scenario" "UGSCENARIO"
  8. SIMULATION_MODEL "NX_simulation" "NXSimulation"
  9. MOTION_MODEL "NX_simulation" "NXMotion"
  10. CAE_SOLN_MODEL "NX_simulation" "CAESolution"
  11. CAE_MESH_MODEL "NX_simulation" "CAEMesh"
  12. CAE_GEOM_MODEL "NX_simulation" "CAEGeom"
  13. FOREIGN_MODEL "Foreign" "*"
  14. MOTION_MODEL_SPEC "has specification" "MotionSim"

For the input itemIds: In case of Default Domain: it is Teamcenter item ID. In case of non-Default Domain: it is the multifield key. e.g. %MFK#%,=item_id=001, object_type=SupplierPart, supplier_code=x And the encoded part filename would be containing the MFK.

Created in NX6.0.3

License requirements: None.

Parameters
itemIdsMultifield Key.
itemRevisionIdsTeamcenter item revision ids.
datasetNamesTeamcenter dataset names.
datasetTypeNamesNX dataset type names.
datasetRelationTypeNamesNX dataset relation type names.
baseDirectoryNamesBase export directory name.
toolNamesTool names ("UGII V10-ALL").
exportDirectoryNamesResulting location of export directory
Returns
Result codes. Success (0), failure (non-zero).
unsafe void NXOpen.PDM.FileManagement.ExportNamedReferences ( string  itemId,
string  itemRevisionId,
string  datasetName,
string  datasetTypeName,
string  datasetRelationTypeName,
string  datasetNamedReference,
string  exportDirectoryName,
out string[]  namedReferences 
)
inline

Export Named Reference From Teamcenter.

The Dataset Relation Type Names are the names of the Teamcenter relationships used to find the Datasets to the correponding Item Revisions. Any ImanRelation types can be used.

Created in NX1847.0.0

License requirements: None.

Parameters
itemIdMultifield key.
itemRevisionIdTeamcenter item revision ids.
datasetNameTeamcenter dataset names.
datasetTypeNameNX dataset type names.
datasetRelationTypeNameExact Teamcenter relation type names.
datasetNamedReferenceNX dataset named reference names.
exportDirectoryNameWhere to export files to, if empty then files will not be downloaded
namedReferencesNamedReferences, full pathnames of files
unsafe int [] NXOpen.PDM.FileManagement.ExportNamedReferences ( string[]  itemIds,
string[]  itemRevisionIds,
string[]  datasetNames,
string[]  datasetTypeNames,
string[]  datasetRelationTypeNames,
string[]  datasetNamedReferences,
string  exportDirectoryName,
out int[]  numNamedReferences,
out string[]  namedReferences 
)
inline

Export Named Reference From Teamcenter.

The Dataset Relation Type Names are the names of the Teamcenter relationships used to find the Datasets to the correponding Item Revisions. Any ImanRelation types can be used.

Created in NX1872.0.0

License requirements: None.

Parameters
itemIdsMultifield key.
itemRevisionIdsTeamcenter item revision ids.
datasetNamesTeamcenter dataset names.
datasetTypeNamesNX dataset type names.
datasetRelationTypeNamesExact Teamcenter relation type names.
datasetNamedReferencesNX dataset named reference names.
exportDirectoryNameWhere to export files to, if empty then files will not be downloaded
numNamedReferencesArray of the number of named references for each itemid
namedReferencesNamedReferences, full pathnames of files, array size is namedReferencesLength
Returns
Result codes. Success (0), failure (non-zero).
override void NXOpen.PDM.FileManagement.FreeResource ( )
inlineprotectedvirtual

Frees the object from memory.

After this method is called, it is illegal to use the object. In .NET, this method is automatically called when the object is deleted by the garbage collector.

Created in NX6.0.3

License requirements: None.

Implements NXOpen.TransientObject.

unsafe NXOpen.PDM.PdmFile [] NXOpen.PDM.FileManagement.GetAssociatedFiles ( NXOpen.BasePart[]  parts,
NXOpen.PDM.FileManagement.FileType[]  fileTypesToExclude 
)
inline

Given an NX part, this method will return a list of named reference files in the corresponding Teamcenter dataset.

Created in NX11.0.0

License requirements: None.

Parameters
parts
fileTypesToExclude
Returns
unsafe int [] NXOpen.PDM.FileManagement.GetAttachedFiles ( NXOpen.NXObject[]  associatedObject,
string[]  associationTypeName,
string[]  datasetTypeName,
string[]  datasetName,
string[]  namedReferenceName,
string[]  isText,
string[]  logicalFileName,
string  exportDirectoryName,
out int[]  numOutputFiles,
out NXOpen.PDM.PdmFile[]  files 
)
inline

Get Attached Files Information From Teamcenter.

Query attached files information for given specifications. . associatedObject - Teamcenter object the files are attached to; only Parts or Design Elements are supported . associationTypeName - Teamcenter relation type name . datasetTypeName - Teamcenter dataset type name . datasetName - Dataset name for creation or for matching existing dataset . namedReferenceName - Named reference name . isText - Named reference isText flag . logicalFileName - Named reference logical filename . exportDirectoryName - Where to export files to, if empty then files will not be downloaded . outputFilesLength - Number of total files returned

Created in NX1872.0.0

License requirements: None.

Parameters
associatedObjectTeamcenter object the files are attached to
associationTypeNameTeamcenter relation type name or property name if association is through property
datasetTypeNameTeamcenter dataset type name
datasetNameDataset name for creation or for matching existing dataset
namedReferenceNameNamed reference name
isTextNamed reference isText flag
logicalFileNameNamed reference logical filename
exportDirectoryNameWhere to export files to, if empty then files will not be downloaded
numOutputFilesNumber of output files for each input
filesOutput - arry of PdmFiles
Returns
Result codes. Success (0), failure (non-zero).
unsafe int [] NXOpen.PDM.FileManagement.ImportFiles ( string[]  itemIds,
string[]  itemRevisionIds,
string[]  datasetNames,
string[]  datasetTypeNames,
string[]  datasetRelationTypeNames,
string[]  importDirectoryNames 
)
inline

Imports all associated files for the specified dataset(s) into the Teamcenter database.

The files will be attached to the dataset(s) as named references. The dataset(s) are identified by their Teamcenter multifield key, Teamcenter item revision id, Teamcenter dataset name, NX dataset type, and NX dataset relation type. An import directory containing the files must be specified for each dataset. An array of PDI result codes is returned indicating the success (0) or failure (non-zero) of each import. The dataset types for FOREIGN_MODEL are the ones included in the Teamcenter preference "TC_NX_Foreign_Datasets". In such a case the input relation type should be "Foreign". The named reference information from BMIDE setting will be used for the imported file extension.

  1. NX dataset types and relation names
  2. NX Model Type NX Relation Type NX Dataset Type
  3. MASTER_MODEL "has shape" "UGMASTER"
  4. SPEC_MODEL "has specification" "UGPART"
  5. MAN_MODEL "has manifestation" "UGPART"
  6. ALTREP_MODEL "has altrep" "UGALTREP"
  7. SCENARIO_MODEL "UG_scenario" "UGSCENARIO"
  8. SIMULATION_MODEL "NX_simulation" "NXSimulation"
  9. MOTION_MODEL "NX_simulation" "NXMotion"
  10. CAE_SOLN_MODEL "NX_simulation" "CAESolution"
  11. CAE_MESH_MODEL "NX_simulation" "CAEMesh"
  12. CAE_GEOM_MODEL "NX_simulation" "CAEGeom"
  13. FOREIGN_MODEL "Foreign" "*"
  14. MOTION_MODEL_SPEC "has specification" "MotionSim"

For the input itemIds: In case of Default Domain: it is Teamcenter item ID. In case of non-Default Domain: it is the multifield key. e.g. %MFK#%,=item_id=001, object_type=SupplierPart, supplier_code=x And the encoded part filename would be containing the MFK.

Created in NX6.0.3

License requirements: None.

Parameters
itemIdsMultifield key.
itemRevisionIdsTeamcenter item revision ids.
datasetNamesTeamcenter dataset names.
datasetTypeNamesNX dataset type names.
datasetRelationTypeNamesNX dataset relation type names.
importDirectoryNamesImport directories which contain the files to import.
Returns
Result codes. Success (0), failure (non-zero).
unsafe int [] NXOpen.PDM.FileManagement.ImportFilesAndCreateDatasets ( string[]  itemIds,
string[]  itemRevisionIds,
string[]  datasetNames,
string[]  datasetTypeNames,
string[]  datasetRelationTypeNames,
string[]  datasetToolNames,
bool[]  fileType,
string[]  namedReferenceNames,
string[]  importFileNames,
string[]  importFileDirectoryNames 
)
inline

Import files and create datasets in Teamcenter.

In order to create multiple datasets at once, please make sure to declare all the arrays of the same desired size. This creates the Items (with the specified item ids) and Item Revisions (with the specified item revision ids) in case they don't exist in Teamcenter. This creates the datasets if no matching dataset exists in Teamcenter. The dataset relation type names are the exact names of the Teamcenter relations used to attach the Datasets to the corresponding Item Revisions. (Any ImanRelation types can be used.)

Created in NX11.0.1

License requirements: None.

Parameters
itemIdsMultifield key. Creates a new item if it does not exist in Teamcenter; updates it if it exists.
itemRevisionIdsTeamcenter item revision ids. Creates a new item revision id if it does not exist in Teamcenter; updates it if it exists.
datasetNamesTeamcenter dataset names. Creates a new dataset if it does not exist in Teamcenter; updates it if it exists.
datasetTypeNamesNX dataset type names.
datasetRelationTypeNamesExact Teamcenter relation type names.
datasetToolNamesNX dataset tool names. This is not currently supported. For future use only.
fileTypeTypes of files - true = Binary, false = Ascii.
namedReferenceNamesNames of named references per NX dataset.
importFileNamesNames of files (with file extension) to import per NX dataset. Please do not include the full directory path.
importFileDirectoryNamesNames of the file directories which contain the files to import.
Returns
Result codes. Success (zero), Failure (non-zero).
unsafe int [] NXOpen.PDM.FileManagement.SaveAttachedFiles ( NXOpen.NXObject[]  associatedObject,
string[]  associationTypeName,
string[]  datasetTypeName,
string[]  datasetName,
int[]  numDatasetPropertyInput,
string[]  datasetPropertyNames,
string[]  datasetPropertyValues,
NXOpen.NXObject[]  ownershipToMatchForNewDataset,
NXOpen.PDM.PdmFile[]  fileVolumeToStore,
string[]  toolUsed,
string[]  datasetDescription,
bool[]  alwaysCreateNewDataset,
bool[]  createNewDatasetVersion,
bool[]  refreshInSessionLoadedLMD,
int[]  numNamedReferencesPerInput,
string[]  namedReferenceName,
bool[]  isText,
string[]  filePath,
string[]  logicalFileName,
bool[]  allowReplace,
bool  outputFiles,
out NXOpen.PDM.PdmFile[]  files 
)
inline

Save Attached Files To Teamcenter.

Save attached files for given specifications. . associatedObject - Teamcenter object the files are attached to; only Parts or Design Elements are supported . associationTypeName - Teamcenter relation type name . datasetTypeName - Teamcenter dataset type name . datasetName - Dataset name for creation or for matching existing dataset . numDatasetPropertyInput - Number of dataset property names input for each dataset input . numTotalDatasetProperties - Number of total dataset properties . datasetPropertyNames - (Optional) To specify required properties when creating new dataset or for updating existing dataset properties . datasetPropertyValues - Dataset property values; optional; need to match one-to-one with datasetPropertyNames . ownershipToMatchForNewDataset - Teamcenter object used to assign new dataset owner; optional . fileVolumeToStore - Teamcenter volume for storing file, default is current session volume; optional . toolUsed - Teamcenter toolUsed for new dataset; optional . datasetDescription - Dataset description for new dataset; optional . alwaysCreateNewDataset - Flag indicating if a new dataset should always be created . createNewDatasetVersion - Flag indicating if new dataset version should be created . refreshInSessionLoadedLMD - Flag indicating if in-session loaded Last-Modified-Date should be refreshed . numNamedReferencesPerInput - Number of named references input for each dataset input . numTotalNamedReferences - Number of total named references input . namedReferenceName - Named reference name . isText - Named reference isText flag . filePath - Named reference file path . logicalFileName - Named reference logical filename . allowReplace - Flag indicating to replace if named reference already exists . outputFiles - Flag indicating if files should be returned

Created in NX1872.0.0

License requirements: None.

Parameters
associatedObjectTeamcenter object the files to be attached to
associationTypeNameTeamcenter relation type name or property name if association is through property
datasetTypeNameTeamcenter dataset type name
datasetNameDataset name for creation or for matching existing dataset
numDatasetPropertyInputNumber of dataset property names input for each dataset input
datasetPropertyNamesDataset property names; optional; to specify required properties when creating new dataset or for updating existing dataset properties
datasetPropertyValuesDataset property values; optional; need to match 1-1 with above datasetPropertyNames
ownershipToMatchForNewDatasetTeamcenter object used to assign new dataset owner; optional
fileVolumeToStoreTeamcenter volume for storing file, default is current session volume; optional
toolUsedTeamcenter toolUsed for new dataset; optional
datasetDescriptionDataset description for new dataset; optional
alwaysCreateNewDatasetFalse (default) - use existing if present; True - always create new
createNewDatasetVersionFalse (default) - use existing if present; True - create new version even if present
refreshInSessionLoadedLMDTrue (default) - refresh in-session loaded Last-Modified-Date; False - do nothing
numNamedReferencesPerInputNumber of named references input for each dataset input
namedReferenceNameNamed reference name
isTextNamed reference isText flag
filePathNamed reference file path
logicalFileNameNamed reference logical filename
allowReplaceTrue (default) - replace existing if present; False - always create new
outputFilesFalse (default) - do not return files; True - return files
filesOutput - arry of PdmFiles
Returns
Result codes. Success (0), failure (non-zero).

The documentation for this class was generated from the following file:
Copyright 2019 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.