Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Journal to import part file in Team Center

Status
Not open for further replies.

Kenja824

Automotive
Nov 5, 2014
949
I have a journal to import part files in NX with all the notes we need. These even work in Team Center, importing from OS.

Whats the secret to importing another TC file into a TC file?

Also, is it hard to make it so one can select a position (Cursor point) to import the file instead of coming in at absolute?

Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.
 
Replies continue below

Recommended for you

I think you will have to give more detail of what you are trying to do.
In Teamcenter you may want to check out
File -> New -> Dataset

Jerry J.
UGV5-NX1884
 
I have the following code that seems to work in NX and TC. It imports a file from the OS into the file you are currently in. We do this to have a group of specific notes in that file. We hit a button and it automatically places them in the drawing on drafting for us.

I would like to do the same thing while in a TC file, but I need to import another TC file and I need it to allow the user to pick a place in the screen for the file to land rather than just come in automatically at Zero.

One other important note. This will be used while expanded into a view if that makes a difference.

Code:
Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String) 

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display

' ----------------------------------------------
'   Menu: File->Import->Part...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Import Part")

        workPart.Layers.WorkLayer = 253

        Dim partImporter1 As PartImporter
partImporter1 = workPart.ImportManager.CreatePartImporter()

partImporter1.FileName = "R:\hms_tools\NX1872\Tooling\part\Notes\View_Z.prt"

partImporter1.Scale = 1.0

partImporter1.CreateNamedGroup = False

partImporter1.ImportViews = False

partImporter1.ImportCamObjects = False

partImporter1.LayerOption = PartImporter.LayerOptionType.Work

partImporter1.DestinationCoordinateSystemSpecification = PartImporter.DestinationCoordinateSystemSpecificationType.Work

Dim element1 As Matrix3x3
element1.Xx = 1.0
element1.Xy = 0.0
element1.Xz = 0.0
element1.Yx = 0.0
element1.Yy = 1.0
element1.Yz = 0.0
element1.Zx = 0.0
element1.Zy = 0.0
element1.Zz = 1.0
Dim nXMatrix1 As NXMatrix
nXMatrix1 = workPart.NXMatrices.Create(element1)

partImporter1.DestinationCoordinateSystem = nXMatrix1

Dim destinationPoint1 As Point3d = New Point3d(0.0, 0.0, 0.0)
partImporter1.DestinationPoint = destinationPoint1

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Import Part Commit")

Dim nXObject1 As NXObject
nXObject1 = partImporter1.Commit()

theSession.DeleteUndoMark(markId2, Nothing)

partImporter1.Destroy()

' ----------------------------------------------
'   Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module

Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor