Showing results for 
Search instead for 
Do you mean 
Reply

NXopen.CAE.Post.PostViewUpdate

Hello,

I have created a function which shows a result, then applies a template to the result. This far it works fine. After applying the template the result saved in the template is shown again (Instead of the result I set before). In order to overcome I have added the following code (I included the code from the creation of the postview):

'the postview is created in order to be able to apply the template. Later on the result is set again to override the result set by applying the template
Dim PostviewId As Int32
PostviewId = theSession.Post.CreatePostviewForResult(0, solutionResult1, False, resultParameters1)

' The template is applied and then the result set again.
' This is because when saving the template, the result at this time of saving is also saved.
' Applying the template after the CreatePostviewForResult would show again the result saved in the template.
theSession.Post.PostviewApplyTemplate(PostviewId, Template_ID)
theSession.Post.PostviewUpdate(PostviewId)

' The Result is set again, to override the result set by applying the template
' The following 2 lines of code should work, but it gives a runtime error. Don't know why.
' Tried creating a new postview, but then the settings from the template are partially lost.
theSession.Post.PostviewSetResult(PostviewId, resultParameters1)
theSession.Post.PostviewUpdate(PostviewId)

Return PostviewId
theSession.ResultManager.DeleteResultParameters(resultParameters1)


End Function

 I now get a runtime error "The input is invalid for this operation" for the second call to thesessoin.post.PostviewUpdate(PostviewId), while it is exactly the same as the call 7 lines earlier, which goes ok.

 

I have added the complete function as an attachment.

 

What am I missing?

 

Regards,

Frederik

1 REPLY

Re: NXopen.CAE.Post.PostViewUpdate

Hello,

 

Problem still not solved, but I have found a workaround:

The problem is that the template contains a reference to the result at the time the template was created. I located the templated and deleted the reference to the result in the template .xml file (with a normal text editor). This is a work-around to the inital problem, but does not answer why the routine gives a runtime error after the second call to thesession.post.postviewupdate(PostviewID)

 

Regards,

Frederik