cancel
Showing results for 
Search instead for 
Did you mean: 

Update callback: Undo marks error

Creator
Creator

Hello everyone!

 

I'm trying to perform the following action inside the update callback for a button:

 

Dim sTLImportBuilder1 As NXOpen.Facet.STLImportBuilder
 sTLImportBuilder1 = workPart.FacetedBodies.CreateSTLImportBuilder()
sTLImportBuilder1.File = "..."


Dim nXObject1 As NXOpen.NXObject
nXObject1 = sTLImportBuilder1.Commit()

 

It gives me the following error: "An operation was performed that deleted undo marks created by dialog framework."

 

What is the right way to do that? Or is such an operation only allowed inside the Apply or Ok callbacks? Thank you

 

Best Regards

2 REPLIES

Re: Update callback: Undo marks error

Esteemed Contributor
Esteemed Contributor

I would only collect information in the update callback.

Creation or deletion of objects should be done in the apply callback which is called by the OK callback.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Update callback: Undo marks error

Siemens Phenom Siemens Phenom
Siemens Phenom

The specific behavior varies a little bit depending on your version, but oddly enough, we have a warning in the docs about importing STL files while a Block UI Styler dialog is up.

 

This is from the V10 docs, under Block UI Styler -> Automation Code -> Using Undo Marks:

 

In automation code, you can call NXOpen or UF APIs to undo actions.

A user can work only with the undo marks that are created using the automation code. It is expected that undo marks created in any callback must be deleted in the same callback or else the dialog framework automatically deletes that undo mark after the callback execution.

You can undo up to a mark in one of the following ways.

 

Explicit method

 

Use direct APIs which delete the undo mark such as Session.UndoToMark(). Attempts to delete the undo marks that are created by the dialog box framework result in an exception, and the dialog box remains open.

 

Implicit method

 

Some indirect APIs perform actions which result in the deletion of the undo mark.

When a user attempts to undo actions up to the undo mark created by the dialog box framework, an exception occurs, and the dialog box closes. You can use such APIs only in the OK and Apply callbacks and not in any other callbacks. For example, the UF_STD_import_stl_binary_file API imports a file and removes all undo marks that exist in the NX session.

Note

When a Block UI Styler application shows a second dialog box from the Update callback of the first dialog box, undo is unavailable. After you exit the second dialog box, there are no visible undo marks to undo operations completed in the second dialog box.