×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

NX 7.5 IDENTIFICATION SYMBOL

NX 7.5 IDENTIFICATION SYMBOL

NX 7.5 IDENTIFICATION SYMBOL

(OP)
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.

RE: NX 7.5 IDENTIFICATION SYMBOL

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

RE: NX 7.5 IDENTIFICATION SYMBOL

(OP)
Thanks a lot man it works very well

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources