Forums:
I have simple journal that walks through the assembly and attempts to fully load and un-blank any partially loaded components. My assembly is pre-loaded with partially loaded components that have not been un-blanked.
I'm noticing that with this particular assembly the .UnBlank() method will not work on a fully loaded component unless it has already been un-blanked. In other words unless I go in and un-blank the component manually. Which defeats the purpose of using the code in the first place. At least for my use case. I'm curious, does anyone know why this may be, or perhaps any other approaches I can take?
Imports System Imports NXOpen Imports NXOpen.Assemblies Module NXJournal Dim theSession As Session = Session.GetSession()Dim theUI As UI = UI.GetUI() Sub Main (ByVal args()AsString) Dim part1 As Part part1 = theSession.Parts.DisplayDim c As Component = part1.ComponentAssembly.RootComponent ShowAssemblyTree(c, "") EndSub Sub ShowAssemblyTree(ByVal c As Component, ByVal indent AsString)Dim children As Component()= c.GetChildren()Dim newIndent AsStringDim childName asString ForEach child As Component In children If indent.Length=0Then newIndent =" "Else newIndent = indent &" "EndIf childName = child.DisplayName Dim thePart As Part = child.Prototype.OwningPart ' fully load and un-blank all partially loaded componentsTryIf thePart.IsFullyLoadedThen echo(childName &" Is Loaded")Else' part is loaded partially, child.Prototype.OwningPart.LoadThisPartFully() child.UnBlank() echo(childName &" Is partially Loaded")EndIfCatch ex As NullReferenceException 'component is not loadedEndTry ShowAssemblyTree(child, newIndent)Next EndSub Sub Echo(ByVal output AsString) theSession.ListingWindow.Open() theSession.ListingWindow.WriteLine(output) theSession.LogFile.WriteLine(output)EndSub EndModule