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
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 Modulewww.nxjournaling.com
RE: next page in drafting
Cj Silver
Tooling Engineer BAE Systems
Working to remember all I forgotten
RE: next page in drafting
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
Cj Silver
Tooling Engineer BAE Systems
Working to remember all I forgotten