Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX 7.5 IDENTIFICATION SYMBOL

Status
Not open for further replies.

Altojoe

New member
Mar 16, 2013
23
Hi I need a a VB Script in Order to filter TYPE IDENTIFICATON SYMBOL>>> SUBTYPE>>> Triangle Point Up-Identification Symbol
in all the Sheets of the Drawing and delete it. Please Solve this.
 
Replies continue below

Recommended for you

Code:
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen

Module delete_ID_symbols

    Sub Main()

        Dim theSession As Session = Session.GetSession()

        If IsNothing(theSession.Parts.Work) Then
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "Delete ID symbols: triangle up"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        If workPart.Annotations.IdSymbols.ToArray.Length = 0 Then
            lw.WriteLine("No ID symbols found in current work part")
            Return
        End If

        Dim triangleUp As New List(Of Annotations.IdSymbol)

        'loop through all the ID symbols in the part
        For Each tempID As Annotations.IdSymbol In workPart.Annotations.IdSymbols

            Dim oldIdBuilder As Annotations.IdSymbolBuilder

            oldIdBuilder = workPart.Annotations.IdSymbols.CreateIdSymbolBuilder(tempID)

            'type of symbol to change
            If oldIdBuilder.Type = Annotations.IdSymbolBuilder.SymbolTypes.TriangleUp Then
                triangleUp.Add(tempID)
            End If

            oldIdBuilder.Destroy()

        Next

        Try

            theSession.UpdateManager.ClearErrorList()

            Dim markId2 As Session.UndoMarkId
            markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Delete ID symbols")

            Dim nErrs1 As Integer
            nErrs1 = theSession.UpdateManager.AddToDeleteList(triangleUp.ToArray)

            Dim nErrs2 As Integer
            nErrs2 = theSession.UpdateManager.DoUpdate(markId2)

        Catch ex As NXException
            theSession.UndoToMark(markId1, undoMarkName)
            MsgBox(ex.Message)

        End Try


        lw.Close()

    End Sub

End Module

www.nxjournaling.com
 
Thanks a lot man it works very well
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor