Selective Loading in the assembly navigator
Selective Loading in the assembly navigator
(OP)
I'm coming back to NX after running Catia for the last 7 years. There was a function in NX, I believe was called "selective loading", that was essentially a "categories" for the assembly navigator. It allowed the user to created nodes in the assy navigator that allowed the user to open certain files selectively, avoiding the need to search for those files each opening. I can't find that function. Does it still exist? Where is the button?
Thanks for anyone who can help with this.
Thanks for anyone who can help with this.





RE: Selective Loading in the assembly navigator
RE: Selective Loading in the assembly navigator
You can load certain parts in a assembly.
Then File > Save Bookmark >
To load the assembly in the same state go File > Open Bookmark >
Hope this is what you're looking for...
RE: Selective Loading in the assembly navigator
"Know the rules well, so you can break them effectively."
-Dalai Lama XIV
RE: Selective Loading in the assembly navigator
Thanks all for your help.
'ziner
RE: Selective Loading in the assembly navigator
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports System.Collections
Imports System.Windows.Forms
Imports System.Collections.Generic
Imports NXOpenUI
Module NXJournal
Dim theSession As Session = Session.GetSession()
Dim theUFSession As UFSession = UFSession.GetUFSession()
Dim workPart As Part = theSession.Parts.Work
Dim UserInputNumber As String
Dim lw As ListingWindow = theSession.ListingWindow
Sub DoIt()
Dim allComps() As Assemblies.Component = Nothing
Dim CompCounts() As Integer = Nothing
getAllChildrenPacked(workPart, allComps, CompCounts)
For ii As Integer = 0 To allComps.Length - 1
Echo(allComps(ii).DisplayName & " X " & CompCounts(ii))
Next
End Sub
Sub getAllChildrenPacked(ByVal assy As BasePart, ByRef children() As Assemblies.Component, ByRef counts() As Integer)
Dim theChildren As Collections.ArrayList = New Collections.ArrayList
Dim theCounts As Collections.ArrayList = New Collections.ArrayList
Dim theChildNames As Collections.ArrayList = New Collections.ArrayList
For Each child As Assemblies.Component In getAllChildren(assy)
Dim thisChildName As String = child.DisplayName
If theChildNames.Contains(thisChildName) Then
theCounts.Item(theChildNames.IndexOf(thisChildName)) = theCounts.Item(theChildNames.IndexOf(thisChildName)) + 1
Else
theChildren.Add(child)
theChildNames.Add(thisChildName)
theCounts.Add(1)
End If
Next
children = theChildren.ToArray(GetType(Assemblies.Component))
counts = theCounts.ToArray(GetType(Integer))
End Sub
Function getAllChildren(ByVal assy As BasePart) As Assemblies.Component()
Dim theChildren As Collections.ArrayList = New Collections.ArrayList
Dim aChildTag As Tag = Tag.Null
Do
theUFSession.Obj.CycleObjsInPart(assy.Tag, UFConstants.UF_component_type, aChildTag)
If (aChildTag = Tag.Null) Then Exit Do
Dim aChild As Assemblies.Component = NXObjectManager.Get(aChildTag)
theChildren.Add(aChild)
Loop
Return theChildren.ToArray(GetType(Assemblies.Component))
End Function
Public Sub Main(ByVal args As String())
If workPart IsNot Nothing Then
DoIt()
UserInputNumber = NXInputBox.GetInputString("Enter Partial Text of Components To Load", "Text", "")
If UserInputNumber = "" Then
Exit Sub
Else
Dim allComps2() As Assemblies.Component = Nothing
Dim CompCounts2() As Integer = Nothing
Dim theFoundKids As Collections.ArrayList = New Collections.ArrayList
getAllChildrenPacked(workPart, allComps2, CompCounts2)
For Each allComps3 As Assemblies.Component In allComps2
Dim nameCount As Integer = allComps3.DisplayName.ToString.Length
Dim strippedName As String
If nameCount > 8 Then
strippedName = Right(allComps3.DisplayName.ToString, (nameCount-5))
End If
lw.Open()
If strippedName.Contains(UserInputNumber) Then
Dim componentsToOpen1(0) As Assemblies.Component
Dim component2 As Assemblies.Component = allComps3
componentsToOpen1(0) = component2
Dim option1 As Boolean
option1 = theSession.Parts.LoadOptions.UsePartialLoading
lw.Open()
lw.WriteLine(component2.DisplayName.ToString+" component2 Name")
Dim openStatus1() As Assemblies.ComponentAssembly.OpenComponentStatus
Dim partLoadStatus1 As PartLoadStatus
partLoadStatus1 = workPart.ComponentAssembly.OpenComponents(Assemblies.ComponentAssembly.OpenOption.WholeAssembly, componentsToOpen1, openStatus1)
theFoundKids.Add(allComps3)
lw.WriteLine(componentsToOpen1(0).DisplayName.ToString+" componentsToOpen1")
lw.WriteLine(openStatus1(0).ToString+” openStatus”)
partLoadStatus1.Dispose()
If openStatus1(0).ToString = "CouldNotOpen" Then
MessageBox.Show("Unable to load, please load manually")
End If
End If
Next
'-------------------------Error Message if None Found-------------------------------
If theFoundKids.Count < 1 Then
MessageBox.Show("Component Not Found!")
End If
'-------------------------Show Components Getting Loaded---------NOT DONE YET-------------------
lw.WriteLine(theFoundKids.Count.ToString+" theFoundKids")
lw.WriteLine(UserInputNumber.ToString+" UserInputNumber")
lw.Close()
End If
Return
End If
For ii As Integer = 0 To args.Length - 1
Echo("Processing: " & args(ii))
Try
Dim loadStatus As PartLoadStatus = Nothing
workPart = TryCast(theSession.Parts.OpenBaseDisplay(args(ii), loadStatus), Part)
reportPartLoadStatus(loadStatus)
DoIt()
workPart.Close(BasePart.CloseWholeTree.True, BasePart.CloseModified.CloseModified, Nothing)
Catch ex As NXException
Echo(" " & ex.Message)
End Try
Next
End Sub
Sub Echo(ByVal output As String)
'theSession.ListingWindow.Open()
'theSession.ListingWindow.WriteLine(output)
'theSession.LogFile.WriteLine(output)
End Sub
Sub reportPartLoadStatus(ByVal load_status As PartLoadStatus)
If load_status.NumberUnloadedParts = 0 Then
Return
End If
Echo(" Load notes:")
For ii As Integer = 0 To load_status.NumberUnloadedParts - 1
Echo(" " & load_status.GetPartName(ii) & " - " & load_status.GetStatusDescription(ii))
Next
End Sub
Public Function GetUnloadOption(ByVal arg As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
RE: Selective Loading in the assembly navigator
- Can you tell us what this code is intended to do ?
I am no programmer, but some talented fellow here might help if we know the objective.
Regards,
Tomas
RE: Selective Loading in the assembly navigator
Do an alt+F11, paste in code, save and give it a try