Implementing .MakeUptoDate method

Hi All,

Can anyone please provide me an example for implementing '.MakeUptoDate()' method(which is equivalent to 'Update for external changes option ' in UG NX)

After some experimentation, it seems that the .MakeUpToDate method does not update expressions that reference an external spreadsheet.

The code below makes use of a KF function to update the NX file; it was taken from a GTAC example (nx_api5457).

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()

Dim theUI As UI = UI.GetUI()
Dim lw As ListingWindow = theSession.ListingWindow

Sub Main()

Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "make up to date")

lw.Open()

UpdateForExternalChange()

lw.Close()

End Sub

Sub UpdateForExternalChange()

'GTAC example: nx_api5457
'author: Amy Webster
'
' Static void UpdateForExternalChange()
'{
' String ruleName;
' theUfSession.Cfi.GetUniqueFilename(out ruleName);
' workPart.RuleManager.CreateDynamicRule("root:", ruleName,
' "Any", "%ug_updateForExternalChange(false)", "");
' workPart.RuleManager.Evaluate(ruleName + ":");
' workPart.RuleManager.DeleteDynamicRule("root:", ruleName);
'}

Dim ruleName As String = Nothing
theUfSession.Cfi.GetUniqueFilename(ruleName)
theSession.Parts.Work.RuleManager.CreateDynamicRule("root:", ruleName, "Any", "%ug_updateForExternalChange(false)", "")
theSession.Parts.Work.RuleManager.Evaluate(ruleName & ":")
theSession.Parts.Work.RuleManager.DeleteDynamicRule("root:", ruleName)

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

I have been trying to run the above code .but it is showing some syntax error and I'm unable to resolve it :(

The code works fine on my machine. What is the text of the error that you are getting?