I have created a auto layer correction tool. As the tool runs, the layers of the objects are modied. But the layer column in the part navigator is not updating after the tool runs. I need to separately off the column and the on it again to get the updated layers. Can anyone help me with how to update the coulmns automatically.
I am using C# for coding in NX Open.
Solved! Go to Solution.
How do you move the objects in the different layer? Using NXOpen API or Wrapper functions.
Are you executing the tool in the assembly context?
I have tested with simple tool and the layer numbers are updated in the column. I used the following APIs to check that.
NXOpen API: Session.GetSession.Parts.Work.Layers.MoveDisplayableObjects(.....)
Wrapper API: UFSession.GetUFSession.Obj.SetLayer(...)
Try to use the above methods and check the columns are updating.
I am directly assigning the layer to the displayable object as object.Layer=Required Layer Number.
Is this the correct way or do i need to change it to any of the methods you mentioned?
Did you redisplay the object as suggested in the NXOpen.DisplayableObject.Layer documentation?
After setting the layer, you must call RedisplayObject in order for the change to take effect, except see the comments for NXOpen.DisplayableObject.Color .
Alternately, you can use a DisplayModification object to move geometry to a different layer; it will take care of the update when you call the .Apply method. The display modification object will allow you to modify multiple objects in one call, possibly simplifying your code.