Showing results for 
Search instead for 
Do you mean 

Error: This operation can only be done on the display part

[ Edited ]

I am trying to loop through an assembly, display the part, and set the RenderingStyleType to be ShadedWithEdges. However, when I apply the 


It returns "This operation can only be done on the display part".  I tried to have a code to make the child to be a work component but it still fails. Any suggestion will be appreciated.


        Dim c As ComponentAssembly = dispPart.ComponentAssembly
        Dim comp As Component = c.RootComponent

        For Each child As Component In comp.GetChildren()
            Dim partLoadStatus1 As PartLoadStatus = Nothing
            Dim status1 As PartCollection.SdpsStatus
            Dim part1 As NXOpen.Part = CType(theSession.Parts.FindObject(child.Name), NXOpen.Part)

            'theSession.Parts.SetWorkComponent(child, NXOpen.PartCollection.RefsetOption.Entire, NXOpen.PartCollection.WorkComponentOption.Visible, partLoadStatus1)
            status1 = theSession.Parts.SetDisplay(part1, True, True, partLoadStatus1)
            workPart.ModelingViews.WorkView.RenderingStyle = NXOpen.View.RenderingStyleType.ShadedWithEdges