Ehaviv
Computer
- Jul 2, 2003
- 1,012
Hi All
This journal give correct output in NATIVE but Incorrect output in NX Manager (TC)
can anyone explain why
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Assemblies
Module scan_assembly_toplevel_components_and_report_loadstatus
Dim s As Session = Session.GetSession
Dim ufs As UFSession = UFSession.GetUFSession
Dim dispPart As Part = s.Parts.Work
Dim lw As ListingWindow = s.ListingWindow
Sub Main()
Dim selectedComps(-1) As Assemblies.Component
Dim fmComps(-1) As Assemblies.Component
Dim n_comps As Integer = 0
Dim n1,n2 As Integer
Dim thisName As String
Dim rd_cnt As Integer
Dim counter As Integer = -1
Dim root As Component = dispPart.ComponentAssembly.RootComponent
Dim toplvlComps As Component() = root.GetChildren()
ufs.Ui.ExitListingWindow() ' Clear and close the window
lw.Open()
lw.WriteLine("")
lw.WriteLine("============================================================")
lw.WriteLine(" Program ... START ...")
lw.WriteLine("============================================================")
lw.WriteLine("")
lw.CloseWindow()
n_comps = toplvlComps.Length
lw.WriteLine("Top level components number = " & n_comps.ToString)
lw.WriteLine("")
lw.CloseWindow()
counter = -1
If (n_comps) > 0 Then
For Each thisComp As Component In toplvlComps
If ufs.Part.IsLoaded(thisComp.DisplayName) = 0 Then
lw.WriteLine("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn")
lw.WriteLine(thisComp.DisplayName & " ==> Not loaded")
counter += 1
ReDim Preserve fmComps(counter)
fmComps(counter) = thisComp
End If
If ufs.Part.IsLoaded(thisComp.DisplayName) = 1 Then
lw.WriteLine("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
lw.WriteLine(thisComp.DisplayName & " ==> Fully loaded")
End If
If ufs.Part.IsLoaded(thisComp.DisplayName) = 2 Then
lw.WriteLine("pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp")
lw.WriteLine(thisComp.DisplayName & " ==> Partially loaded")
End If
Next
Else
Exit Sub
End If
lw.WriteLine("")
lw.WriteLine("============================================================")
lw.WriteLine("Number of not loaded components = " & (counter+1).ToString)
lw.WriteLine("============================================================")
lw.WriteLine("")
lw.CloseWindow()
For n1=0 To counter
If fmComps(n1) Is Nothing Then Continue For
thisName = fmComps(n1).DisplayName
rd_cnt = -1
For n2=n1 To counter
If fmComps(n2) Is Nothing Then Continue For
If fmComps(n2).DisplayName = thisName Then
rd_cnt += 1
ReDim Preserve selectedComps(rd_cnt)
selectedComps(rd_cnt) = fmComps(n2)
fmComps(n2) = Nothing
End If
Next
lw.WriteLine("x" & (rd_cnt+1).ToString & " " & thisName & " ==> Not loaded")
lw.WriteLine("------------------------------------------------------------")
lw.CloseWindow()
Next
MsgBox("Replace Components" & vbCrLf & " DONE" _
& vbCrLf & "Elbaz Haviv Feb 2016" _
& vbCrLf & "See Information Window")
lw.WriteLine("")
lw.WriteLine("============================================================")
lw.WriteLine(" Program ... END ...")
lw.WriteLine("============================================================")
lw.WriteLine("")
lw.CloseWindow()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
Thanks in advanced