Hi all,
As in the picture, I tried to delete the extra extruded body after measuring.
https://drive.google.com/file/d/1MFi-ikkWcdx-focQtQ04XGkNzOKSwWiU/view?u...
I found an example of component deletion in the forum which is similar to my recorded journal. Thus I parameterized them a little bit and they work fine with most parts except for the NX example "PlateWithHoles". The extrusion somehow stays there.
Is it because the plate is a sheet body?
If so, how can I deal with it?
I tried the DeleteBody class by referring to API reference and p.47 in Getting Started with NXOpen, and puzzled the first 6 lines of codes.
The problem is that I get NXException: target body missing.
There is indeed body in the partBodiesArray2, so why is the target body missing?
Thanks for your reply in advance and happy new year!
Best regards,
Ray
my codes
''Lösche die Extrusion / Delete the Extrusion 'Dim deleteBody As NXOpen.Features.DeleteBody = Nothing 'Dim deleteBodyBuilder As NXOpen.Features.DeleteBodyBuilder 'deleteBodyBuilder = workPart.Features.CreateDeleteBodyBuilder(deleteBody) 'partBodiesArray2(1) = deleteBodyBuilder.Commit 'deleteBodyBuilder.Destroy Dim markId1 As NXOpen.Session.UndoMarkId = Nothing markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Delete Extrusion") theSession.UpdateManager.ClearErrorList() Dim markId2 As NXOpen.Session.UndoMarkId = Nothing markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Delete Extrusion") Dim objects1(0) As NXOpen.TaggedObject 'Dim extrude1 As NXOpen.Features.Extrude = CType(workPart.Features.FindObject("EXTRUDE(32)"), NXOpen.Features.Extrude) objects1(0) = partBodiesArray2(1) Dim nErrs1 As Integer = Nothing nErrs1 = theSession.UpdateManager.AddObjectsToDeleteList(objects1) Dim id1 As NXOpen.Session.UndoMarkId = Nothing id1 = theSession.NewestVisibleUndoMark Dim nErrs2 As Integer = Nothing nErrs2 = theSession.UpdateManager.DoUpdate(id1) theSession.DeleteUndoMark(markId1, Nothing)