cancel
Showing results for 
Search instead for 
Did you mean: 

Run Method in the Background of NX C# NXOpen

Pioneer
Pioneer

Hi Guys !

 

Is their a NXOpen Method to run another Method which do some Stuff in the Background without updating the view all the time only at the end.

 

i tried with Thread and Backgroundworker.

But with these two function i end up in the Background of Windows.

 

Has somebody an idea ?

 

THanks !!

2 REPLIES

Re: Run Method in the Background c#

Phenom
Phenom

If you just want to prevent the display updating you could try the wrapper for:

UF_DISP_set_display(UF_DISP_SUPPRESS_DISPLAY);

Once your work is finished call the wrappers for:

UF_DISP_set_display(UF_DISP_UNSUPPRESS_DISPLAY);
UF_DISP_regenerate_display();

Not sure if any of this has made it to NXOpen yet without having to use the wrappers. I'm still on NX8.5

 

PS: Using threads in NXOpen code to do work on the model is fraught with danger and not recommended by Siemens.

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: Run Method in the Background of NX C# NXOpen

Experimenter
Experimenter

Here's how to do it in vb.net

 

' turn the display off

theUFSession.Disp.SetDisplay(UFConstants.UF_DISP_SUPPRESS_DISPLAY)

 

<  Construction Geometry Code  >

 

' turn the display back on again

theUFSession.Disp.SetDisplay(UFConstants.UF_DISP_UNSUPPRESS_DISPLAY)

' regenerate the display so it matches what's been going on - very important!

workPart.Views.Regenerate()

 

Another trick when iterating on geometry is to used the undo marks.  I usually wrap iterative geometry code within undo marks.  For example:

 

For i as integer = 0 to 100

Dim markId1 As Session.UndoMarkId

markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "EnlargeAndSplit")

 

<Do some geometry creation here>

 

theSession.UndoToMark(markId1, "EnlargeAndSplit")

 

Next

 

theSession.DeleteUndoMark(markId1, "EnlargeAndSplit")