Need help ''ufs.Fltr.UpdateStructure'' to update the Part navigator ???

Hello,

I use NX9.0.3.4 and my program in VB .NET

I need help with a user function '' ufs.Fltr.UpdateStructure '

In my application, I modified the attributes several components in an assembly.

In my program, to run my function that applies attributed in everyone of the assembly of components, the user presses ''Apply''. So, after pressing ''Apply'' I would like the ''Part Nanigator'' to update you see them attributed to update.

I thought using the ''ufs.Fltr.UpdateStructure'', but I do not how to program it.

I looked for exmple on GTAC and I can not find anything with 'ufs.Fltr.UpdateStructure'.

Someone to help me or can you give me an example?

Thank you!
_____________________________________________________________________
Option Strict Off

Imports System.Drawing.Printing
Imports Microsoft.VisualBasic.FileSystem
Imports Microsoft.VisualBasic.CompilerServices
Imports Microsoft.Win32

Imports System
Imports Microsoft.VisualBasic
Imports System.IO
Imports System.IO.File
Imports System.Collections
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Windows.Forms
Imports System.Environment
Imports System.Drawing

Imports NXOpen.Annotations
Imports NXOpen
Imports NXOpenUI
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Assemblies

Imports NXOpen.LoadOptions
Imports NXOpen.Utilities
Imports NXOpen.Drawings
_________________________________________________________________________
'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
'- FONCTION "Walk" -
'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
' Génère des actions à travers tout les composantes de l'assemblage.
Sub Walk(c As Component, level As Integer)
Dim children As Component() = c.GetChildren()
Dim child As Component
Dim PRT_BALLON_NUM As String = ""
Dim alreadyProcessed As Hashtable
Dim PartLoadStat As PartLoadStatus = Nothing

Try
KNT = KNT + 1
alreadyProcessed = New Hashtable

If TypeOf c.Prototype Is Part Then
Prototype = CType(c.Prototype, Part)

If CleListingWindowVal = True Then
LW.WriteLine("Debut Fonction Walk pour: " & Prototype.Leaf)
End If

If Not alreadyProcessed.Contains(Prototype.Leaf) And c.IsSuppressed = False Then

'Ajouter ce prototype à la hash table afin de ne pas le traiter à nouveau.
alreadyProcessed.Add(Prototype.Leaf, Prototype.Leaf)
Dim msgText1 As String
msgText1 = KNT.ToString & (New String(" "c, 1) & Prototype.FullPath)

If CleListingWindowVal = True Then
LW.WriteLine("No-" & msgText1.ToString)
End If

'Pour afficher la pièce.
Try
'TheSession.Parts.SetDisplay(Prototype, False, False, PartLoadStat)
Catch ExWalk001 As Exception
If CleListingWindowVal = True Then
LW.WriteLine("Error running application: " & ExWalk001.Message)
LW.WriteLine("Attempting to change Displayed Part to: " & Prototype.Leaf)
LW.WriteLine("Part Load Status = " & PartLoadStat.ToString)
End If
End Try
End If

AttribueAutoballonAction()
'UpdateStructure()

'* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - ( DRYRUN )- * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -

If Me.Txt_PrtAction.Text = "DryRun" And Attr_Prt_AutoBallonAction = "True" Then

DryRun()
'UpdateStructure()

ElseIf Me.Txt_PrtAction.Text = "DryRun" And Attr_Prt_AutoBallonAction = "False" Then

If CleListingWindowVal = True Then
LW.WriteLine("Debut Fonction DryRun")
LW.WriteLine(" DryRun = Impossible pour" & Prototype.Leaf)
LW.WriteLine("Fin Fonction DryRun pour: " & Prototype.Leaf)
End If

End If

'* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - ( RAZ )- * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -

If Me.Txt_PrtAction.Text = "Raz" And Attr_Prt_AutoBallonAction = "True" Then

Raz()

ElseIf Me.Txt_PrtAction.Text = "Raz" And Attr_Prt_AutoBallonAction = "False" Then

If CleListingWindowVal = True Then
LW.WriteLine("Debut Fonction RAZ")
LW.WriteLine(" Raz = Impossible pour" & Prototype.Leaf)
LW.WriteLine("Fin Fonction RAZ pour: " & Prototype.Leaf)
End If

End If

'* - * -* - * -* - * -* - * -* - * -* - * -* - * -*( AUTONUMBER SEUL. ) - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* -

If Me.Txt_PrtAction.Text = "AutoNumberSeul" And Attr_Prt_AutoBallonAction = "True" Then

AutoNumberSeul()

ElseIf Me.Txt_PrtAction.Text = "AutoNumberSeul" And Attr_Prt_AutoBallonAction = "False" Then

If CleListingWindowVal = True Then
LW.WriteLine("Debut Fonction AutoNumberSeul")
LW.WriteLine(" L'attribue PRT_AUTOBALLON existe =" & Attr_Prt_AutoBallonExiste.ToString)
LW.WriteLine(" AutoNumberSeul = Impossible pour" & Prototype.Leaf)
LW.WriteLine("Fin Fonction AutoNumberSeul pour: " & Prototype.Leaf)
End If

End If

'* - * -* - * -* - * -* - * -* - * -* - * -* - * -*( POPULER SEUL. ) - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* -

If Me.Txt_PrtAction.Text = "PopulerSeul" And Attr_Prt_AutoBallonAction = "True" Then

PopulerSeul()

ElseIf Me.Txt_PrtAction.Text = "PopulerSeul" And Attr_Prt_AutoBallonAction = "False" Then

If CleListingWindowVal = True Then
LW.WriteLine("Debut Fonction PopulerSeul")
LW.WriteLine(" PopulerSeul = Impossible pour" & Prototype.Leaf)
LW.WriteLine("Fin Fonction PopulerSeul pour: " & Prototype.Leaf)
End If

End If

'* - * -* - * -* - * -* - * -* - * -* - * -* - * -*( POPULER & AUTONUMBER ) - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* - * -* -

If Me.Txt_PrtAction.Text = "PopulerEtAutoNumber" And Attr_Prt_AutoBallonAction = "True" And KNT_MainAssy = 1 Then

PopulerEtAutoNumber()

ElseIf Me.Txt_PrtAction.Text = "PopulerEtAutoNumber" And Attr_Prt_AutoBallonAction = "False" Then

If CleListingWindowVal = True Then
LW.WriteLine("Debut Fonction Populer Et AutoNumber")
LW.WriteLine(" PopulerEtAutoNumber = Impossible pour" & Prototype.Leaf)
LW.WriteLine("Fin Fonction Populer Et AutoNumber pour: " & Prototype.Leaf)
End If

End If
End If

If CleListingWindowVal = True Then
LW.WriteLine("Fin Fonction Walk pour: " & Prototype.Leaf)
LW.WriteLine("")
End If
Catch ExWalk002 As Exception

If CleListingWindowVal = True Then
LW.WriteLine(" Process = Erreur fonction Walk!")
End If

End Try

For Each child In children
'Update la structure d'un assemblage, pièces et attribues.
ufs.Fltr.UpdateStructure(Prototype.Tag)
Walk(child, level + 1)
Next
End Sub

Do the new attribute values show up after running the update structure command in interactive NX? (right click the assembly in the ANT, choose "update structure", pick one or more components).

Yes when I leave my program with my button ''Exit'' the Part Navigator will be update correctly.

But, I want the Part Navigator updating itself when I press the ''Apply'' button in my program . I do not want the user to be forced to leave the program to see if all attributed match what he wants. I want him see them in real time.

I thought I could make an update the Part Navigator with function ''ufs.Fltr.UpdateStructure''.
__________________________________
For Each child In children
'Update la structure d'un assemblage, pièces et attribues.
ufs.Fltr.UpdateStructure(Prototype.Tag)
Walk(child, level + 1)
Next
End Sub
_____________________________________________

Tanks

Pat

What happens when you run that code? Do you get any error messages?

YES, in NX I have an ERROR

When i'm starting my program in NX, i dont have no error, all it's ok

But, when i click on ''APPLY", i'm obtain this error
______________________________________________________________

Consultez la fin de ce message pour plus de détails sur l'appel du débogage
juste-à-temps (JIT) à la place de cette boîte de dialogue.

************** Texte de l'exception **************
NXOpen.NXException:
NX License Error: License server system does not support this feature. [ -18 ]

à NXOpen.UF.UFFltr.UpdateStructure(Tag part)
à Populateur.Populateur_Versions.Walk(Component c, Int32 level)
à Populateur.Populateur_Versions.Appliquer_Click(Object sender, EventArgs e)
à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
à System.Windows.Forms.Control.WndProc(Message& m)
à System.Windows.Forms.ButtonBase.WndProc(Message& m)
à System.Windows.Forms.Button.WndProc(Message& m)
à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Assemblys chargés **************
mscorlib
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34209 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
ManagedLoader
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.0.0
CodeBase : file:///C:/Siemens/NX9.0/ugii/managed/ManagedLoader.dll
----------------------------------------
System
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34238 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34209 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34234 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
NX9.0_Projet_Populateur
Version de l'assembly : 1.0.0.0
Version Win32 : 1.0.0.0
CodeBase : file:///C:/Temp_NX/SettingNX/NX9.0_Projet_Populateur.EXE
----------------------------------------
Microsoft.VisualBasic
Version de l'assembly : 10.0.0.0
Version Win32 : 12.0.51209.34209 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Windows.Forms
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34209 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34209 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Accessibility
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34209 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Runtime.Remoting
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34245 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
NXOpen
Version de l'assembly : 9.0.3.4
Version Win32 : 9.0.3.4
CodeBase : file:///C:/Siemens/NX9.0/ugii/managed/NXOpen.dll
----------------------------------------
NXOpen.Utilities
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.0.0
CodeBase : file:///C:/Siemens/NX9.0/ugii/managed/NXOpen.Utilities.DLL
----------------------------------------
NXOpen.UF
Version de l'assembly : 9.0.2.5
Version Win32 : 9.0.2.5
CodeBase : file:///C:/Siemens/NX9.0/ugii/managed/NXOpen.UF.dll
----------------------------------------
System.Core
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.34209 built by: FX452RTMGDR
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms.resources
Version de l'assembly : 4.0.0.0
Version Win32 : 4.0.30319.18408 built by: FX451RTMGREL
CodeBase : file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_fr_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

************** Débogage JIT **************
Pour activer le débogage juste-à-temps (JIT), le fichier de configuration pour cette
application ou cet ordinateur (machine.config) doit avoir la valeur
jitDebugging définie dans la section system.windows.forms.
L'application doit également être compilée avec le débogage
activé.

Par exemple :

Lorsque le débogage juste-à-temps est activé, les exceptions non gérées
seront envoyées au débogueur JIT inscrit sur l'ordinateur
plutôt que d'être gérées par cette boîte de dialogue.
_______________________________________________________________

Pat

The function:
NXOpen.UF.UFFltr.UpdateStructure(Tag part)
uses the advanced assemblies license, which I assume you do not have because of the message:
NX License Error: License server system does not support this feature. [ -18 ]

Instead of: NXOpen.UF.UFFltr.UpdateStructure(Tag part), I suggest trying the component object's .UpdateStructure method instead. The documentation does not list any special license requirement.

Can you give me more info about ''object's .UpdateStructure'' ?
Do you have a little example ?
You talk about ''The documentation'' witch doc ? In NX or Visual Studio ?
____________________
Try
'UF_Update.Fltr.UpdateStructure(Prototype_Update.Tag)
NXOpen.Assemblies.UpdateStructureBuilder()

Catch ExWalk302 As Exception

If CleListingWindowVal = True Then
LW.WriteLine(" Process = Erreur fonction Update Structure-2!")
End If

If CleListingWindowVal = True Then
LW.WriteLine("Fin Fonction Update Structure pour: " & Prototype.Leaf)
LW.WriteLine("")
End If
End Try

For Each Child_Update In Children_Update
UpdateStructure(Child_Update, level + 1)
Next
__________________________________________________
Tanks

Pat

Hello,

I'm new to programming VB, but I manage to programming some stuff.

Could you give me more explanation on how to use "Update Structure".

I dont have the advanced assemblies license, and i try to find an other solution for update the structure of my assy.
I'm trying, with an code, to update my part Navigator when i klic on a button Apply in my program. I want to update the Part Navigator, because i want to know if all my attributes is OK before i'm quit my program.

I try to find an example on GTAC and Internet and i cant find anything.

Also, if you have an example code for me to understand how to know programing "Update Structure"? After, I will work to fit it in my code.

You would be much appreciated me, I have just sort it out for my program works 100%

Regard

Pat

Pat

If NX updates the navigators correctly after you close your program, you might also want to investigate the function: UF.Disp.MakeDisplayUpToDate

This function is meant to be used with Windows (or other non-NX) dialog windows. Perhaps a call to this function will cause NX to update its navigators when you press the Apply button on your form.

Can you help me to program this function ''UF.Disp.MakeDisplayUpToDate'' ?

Can you write a few line of code to explain how it work ?

________________________________________
Option Strict Off

Imports System.Drawing.Printing
Imports Microsoft.VisualBasic.FileSystem
Imports Microsoft.VisualBasic.CompilerServices
Imports Microsoft.Win32

Imports System
Imports Microsoft.VisualBasic
Imports System.IO
Imports System.IO.File
Imports System.Collections
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Windows.Forms
Imports System.Environment
Imports System.Drawing

Imports NXOpen.Annotations
Imports NXOpen
Imports NXOpen.UF.UF '.Net wrapped User Function
Imports NXOpen.Assemblies

Imports NXOpen.LoadOptions
Imports NXOpen.Utilities
Imports NXOpen.Drawings

Public Class Populateur_Versions

Sub Main(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Populateur_Versions_Load
Call Update()
End Sub

Sub Update() ??????????????
UF.Disp.MakeDisplayUpToDate ???????????????
End sub

En Class
_________________________________________

Regard

Pat

Pat

Can you provide a code snippet that shows the problem you are having?

You can post it in the comments or email it to me at info@nxjournaling.com