Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How to load a model in the context of the root assembly in Teamcenter?

Status
Not open for further replies.

junfanbl

Marine/Ocean
Jun 10, 2015
90
Hello,

I need a way to load a model into NX in the context of the root assembly from Teamcenter using NXOpen. I am not sure how to do this. Typically one would do this from Structure Manager, where you can search for a model in the context of the root assembly, and it will find and launch the assembly into NX with the model loaded for you. I tried doing this with a journal recording in progress but it didn't really yield any helpful results. This is all it produced.

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

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim part1 As NXOpen.Part
part1 = theSession.Parts.Display

Dim workPart As NXOpen.Part = theSession.Parts.Work

Dim displayPart As NXOpen.Part = theSession.Parts.Display

Dim envValue1 As String
envValue1 = theSession.GetEnvironmentVariableValue("PRECISION_VALUE")

workPart.Preferences.UserInterface.DialogBoxDecimalPlaces = 3

Dim theUI As NXOpen.UI = NXOpen.UI.GetUI()

theUI.UserInterfacePreferences.DialogBarDecimalPlaces = 3

theUI.UserInterfacePreferences.ListingDecimalPlaces = 3

theSession.LogFile.WriteLine("Successfully updated precision values to default...")

Dim part2 As NXOpen.Part
part2 = theSession.Parts.Display

Dim fullPath1 As String
fullPath1 = workPart.FullPath

Dim historyList1() As NXOpen.BasePart.HistoryEventInformation
historyList1 = workPart.GetHistoryInformation()

Dim part3 As NXOpen.Part
part3 = theSession.Parts.Display

Dim fullPath2 As String
fullPath2 = workPart.FullPath

Dim historyList2() As NXOpen.BasePart.HistoryEventInformation
historyList2 = workPart.GetHistoryInformation()


Dim part4 As NXOpen.Part
part4 = theSession.Parts.Display

Dim fullPath3 As String
fullPath3 = workPart.FullPath

Dim historyList3() As NXOpen.BasePart.HistoryEventInformation
historyList3 = workPart.GetHistoryInformation()


Dim part5 As NXOpen.Part
part5 = theSession.Parts.Display

Dim fullPath4 As String
fullPath4 = workPart.FullPath

Dim historyList4() As NXOpen.BasePart.HistoryEventInformation
historyList4 = workPart.GetHistoryInformation()

Dim part6 As NXOpen.Part
part6 = theSession.Parts.Display

Dim fullPath5 As String
fullPath5 = workPart.FullPath

Dim historyList5() As NXOpen.BasePart.HistoryEventInformation
historyList5 = workPart.GetHistoryInformation()

Dim part7 As NXOpen.Part
part7 = theSession.Parts.Display

Dim fullPath6 As String
fullPath6 = workPart.FullPath

Dim historyList6() As NXOpen.BasePart.HistoryEventInformation
historyList6 = workPart.GetHistoryInformation()

Dim markId1 As NXOpen.Session.UndoMarkId
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Enter Gateway")

Dim part8 As NXOpen.Part
part8 = theSession.Parts.Display

Dim fullPath7 As String
fullPath7 = workPart.FullPath

Dim historyList7() As NXOpen.BasePart.HistoryEventInformation
historyList7 = workPart.GetHistoryInformation()

Dim markId2 As NXOpen.Session.UndoMarkId
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Enter Modeling")

theSession.CleanUpFacetedFacesAndEdges()

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

End Sub
End Module

Only this does not help me much. Does anybody know how to do this in NXOpen?
 
Replies continue below

Recommended for you

I don't understand the purpose, can you clarify ?

Regards,
Tomas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor