×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Teamcenter - NXOpen. Exporting and importing datasets

Teamcenter - NXOpen. Exporting and importing datasets

Teamcenter - NXOpen. Exporting and importing datasets

(OP)
Hi,

I’m trying to export some assemblies form Teamcenter to a local directory C:\. I’m using the example form the NX Open Programmer's Guide but I doesn’t work. I don’t really understand how does it work, do I have to be in a NX managed session or to have Teamcenter open?


CODE --> .NET

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Import_Export_Test

    Dim theSession As Session
    Dim pdmSession As PDM.PdmSession
    Dim fileMgt As PDM.FileManagement

    Sub Main
        theSession = Session.GetSession()
        pdmSession = theSession.PdmSession()
        fileMgt = pdmSession.NewFileManagement()

        Dim itemIds(0) As String
        Dim itemRevIds(0) As String
        Dim datasetNames(0) As String
        Dim datasetTypeNames(0) As String
        Dim datasetRelationTypeNames(0) As String
        Dim baseDirectoryNames(0) As String
        Dim toolNames(0) As String
        Dim exportDirectoryNames(0) As String
        Dim importDirectoryNames(0) As String
        Dim exportResults(0) As Integer
        Dim importResults(0) As integer

        ' Set the TC item id
        itemIds(0) = "001126"

        ' Set the TC item revision id
        itemRevIds(0) = "A"

        ' Set the TC dataset name
        datasetNames(0) = "001126-A"

        ' Set the NX dataset type name
        datasetTypeNames(0) = "UGMASTER"

        ' Set the NX dataset relation type name
        datasetRelationTypeNames(0) = "has shape"

        ' Set the export directory.  This will be appended to the NX
        ' default directory
        baseDirectoryNames(0) = "Export"

        ' Set the tool name.
        toolNames(0) = "UGII V10-ALL"

        ' NX dataset types and relation names
        ' NX Model Type         NX Relation Type         NX Dataset Type
        ' MASTER_MODEL          "has shape"             "UGMASTER" 
        ' SPEC_MODEL            "has specification"     "UGPART"
        ' MAN_MODEL             "has manifestation"     "UGPART"
        ' ALTREP_MODEL          "has altrep"            "UGALTREP"
        ' SCENARIO_MODEL        "UG_scenario"           "UGSCENARIO"
        ' SIMULATION_MODEL      "NX_simulation"         "NXSimulation"
        ' MOTION_MODEL          "NX_simulation"         "NXMotion"
        ' CAE_SOLN_MODEL        "NX_simulation"         "CAESolution"
        ' CAE_MESH_MODEL        "NX_simulation"         "CAEMesh"
        ' CAE_GEOM_MODEL        "NX_simulation"         "CAEGeom"
        ' FOREIGN_MODEL         "Foreign"               "*"


        ' Set the import directory.  This directory should contain the
        ' files that will be added as named references to the specified
        ' dataset.
        importDirectoryNames(0) = "D:\workdir\Import"

        ' Import the files. 
        importResults = fileMgt.ImportFiles(itemIds, itemRevIds,
                                            datasetNames, datasetTypeNames,
                                            datasetRelationTypeNames,
                                            importDirectoryNames)

        ' Export the files. 
        exportResults = fileMgt.ExportFiles(itemIds, itemRevIds,
                                            datasetNames, datasetTypeNames,
                                            datasetRelationTypeNames,
                                            baseDirectoryNames, toolNames,
                                            exportDirectoryNames)


    End Sub

End Module 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources