Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 787

Delete Curve by Name in NX 11

$
0
0

Hello,

I am trying to delete curve by searching its name.
I have used below code and it is working in NX 9 and NX 10 but it is not working in NX 11.
Can anyone please help me to find my mistake ?

 Sub Main   
 
        theSession = Session.GetSession()
        workPart = theSession.Parts.Work
        displayPart = theSession.Parts.Display
        Dim Curves As CurveCollection = workPart.Curves
        Dim bodyname As String = Line
 
        For Each oCurve As Curve In Curves
 
            If oCurve.Name = bodyname Then
 
 
                Dim markId1 As Session.UndoMarkId
                markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Delete")
                Dim notifyOnDelete1 As Boolean
                notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete
                theSession.UpdateManager.ClearErrorList()
 
 
                Dim nErrs1 As Integer
                nErrs1 = theSession.UpdateManager.AddToDeleteList(oCurve)
 
                Dim nErrs2 As Integer
                nErrs2 = theSession.UpdateManager.DoUpdate(markId2)
                theSession.DeleteUndoMark(markId1, Nothing)
 
 
            End If
        Next
    End Sub

Viewing all articles
Browse latest Browse all 787


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>