Showing results for 
Search instead for 
Do you mean 
Reply

How do you enable preview in your own Block-UI styler?

When using NX one of the great features is being able to preview the intent of your opertions... 

Example when subtracting a tool from a target you can preview the results prior to applying so you know if you want to hit apply/ok or not.

Capture.JPG

 I would like to add this preview ability to my own custom Block-UI styler so the user can Preview what will happen. Does any one know how this is accomplished?

 

It would be great if it was just a "Special" choice like set list, etc...

Capture.JPG

6 REPLIES

Re: How do you enable preview in your own Block-UI styler?

You could do it.  You have to add a toggle button, and button with bitmaps.  Create a callback for 'Show Result' button.  Create an Undo mark, apply your changes, show the result, change the bitmap to 'Undo'.  If user selects 'Undo' roll back to undo mark, if 'Apply' or 'OK' is selected, just exit the dialog.

 

I agree it will be a bit easy, if there was a standard block for it.

Re: How do you enable preview in your own Block-UI styler?

Ha! I just replied almost exactly the same on the other post Man Tongue

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: How do you enable preview in your own Block-UI styler?

sorry for the duplicate post! Didn't realize the other one actually went through

Re: How do you enable preview in your own Block-UI styler?

[ Edited ]

Hi,

 

I am trying to do the same with 2 buttons, but getting error.   DoButton performs editing surface feature. RejectButton should undo the edit operation.

 

But I get "undomark is missing" error when using 'UndoToMark'  & 'Cannot undo to this mark in this context' error while using 'undoLastNVisibleMarks' method.   Any help? 

 

public static NXOpen.Session.UndoMarkId markId1;

public int update_cb( NXOpen.BlockStyler.UIBlock block)
{

  if (block == DoButton)
  {
     // set undo mark 
     markId1 = Nts.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Edit");

    // Change some parameters of the feature and then call update 
    int nErrs1;
    nErrs1 = theSession.UpdateManager.DoUpdate(markId1); 
  }
  else if(block == RejectButton)
  {
    theSession.UndoToMark(markId1, null);
  }

}

   

 

Re: How do you enable preview in your own Block-UI styler?

I think you have a variable scope issue. Since the undo mark is declared within the If block, it is only available in that block (and not in the else block, or anywhere else in your code). Try declaring the undo mark outside of the If block (before the If statement) to see if that clears up your problem.

Re: How do you enable preview in your own Block-UI styler?

No.. I moved to outside and still doing nothing. No undo happened.   But there is no exception now.