×
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

next page in drafting

next page in drafting

next page in drafting

(OP)
Create or use grip to automaticly go to next page in drafting without using either pull down or selecting it in part navigator... I have seen one at another location but can not find the way they did it and I am no longer at that location

Cj Silver
Tooling Engineer BAE Systems
Working to remember all I forgotten

RE: next page in drafting

Does it have to be GRIP?
Below is a journal that should switch to the next drawing sheet (by sheet number).

CODE

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

Module Module1

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UF.UFSession = UF.UFSession.GetUFSession

    Sub Main()

        If IsNothing(theSession.Parts.Work) Then
            'active part required
            Return
        End If

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

        Dim currentApplication As Integer
        theUfSession.UF.AskApplicationModule(currentApplication)
        If currentApplication <> UF.UFConstants.UF_APP_DRAFTING Then
            lw.WriteLine("must be in the drafting application")
            Return
        End If

        Const undoMarkName As String = "next drawing page"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        Dim drawingDic As New Dictionary(Of Integer, Drawings.DrawingSheet)
        For Each dwgSheet As Drawings.DrawingSheet In workPart.DrawingSheets
            drawingDic.Add(SheetNumber(dwgSheet), dwgSheet)
        Next

        Dim totalSheets As Integer = workPart.DrawingSheets.ToArray.Length
        'lw.WriteLine("number of drawing sheets: " & totalSheets.ToString)

        Dim curSheetNumber As Integer = SheetNumber(workPart.DrawingSheets.CurrentDrawingSheet)
        'lw.WriteLine("current sheet: " & curSheetNumber.ToString)

        'For Each kvp As KeyValuePair(Of Integer, Drawings.DrawingSheet) In drawingDic
        '    lw.WriteLine("sheet number: " & kvp.Key.ToString & " name: " & kvp.Value.Name)
        'Next

        Dim newSheetNum As Integer = curSheetNumber + 1
        If newSheetNum > totalSheets Then
            newSheetNum = 1
        End If

        Dim newSheet As Drawings.DrawingSheet
        If drawingDic.TryGetValue(newSheetNum, newSheet) Then
            newSheet.Open()
        Else
            'sheet not found
            lw.WriteLine("error: sheet not found")
        End If

        lw.Close()

    End Sub

    Function SheetNumber(ByVal theSheet As Drawings.DrawingSheet) As Integer

        Dim sheetNum As Integer
        Dim theSheetBuilder As Drawings.DrawingSheetBuilder = theSession.Parts.Work.DrawingSheets.DrawingSheetBuilder(theSheet)
        sheetNum = theSheetBuilder.Number

        theSheetBuilder.Destroy()

        Return sheetNum

    End Function

End Module 

www.nxjournaling.com

RE: next page in drafting

(OP)
EXCELLENT, but not sure how to use that code, How do I use it?

Cj Silver
Tooling Engineer BAE Systems
Working to remember all I forgotten

RE: next page in drafting

Copy the text into notepad. Change the .txt extension to .vb.
In Nx goto tools - journal - play (or ALT+F8)browse to the .vb file and run. You can make a shortcut for this by customising a toolbar.

Best regards,

Michaël.

NX7.5.4.4 (NX8.5.3) + TC Unified 8.3
Win 7 64 bit



RE: next page in drafting

(OP)
THANK YOU ALL WORKS GREAT

Cj Silver
Tooling Engineer BAE Systems
Working to remember all I forgotten

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