There's probably a better way, but this is the code that I've been using:
Private Function IsSheetEmpty(ByVal theSheet As Drawings.DrawingSheet) As Boolean
theSheet.Open()
Dim sheetTag As NXOpen.Tag = theSheet.View.Tag
Dim sheetObj As NXOpen.Tag = NXOpen.Tag.Null
_theUfSession.View.CycleObjects(sheetTag, UFView.CycleObjectsEnum.VisibleObjects, sheetObj)
If (sheetObj = NXOpen.Tag.Null) And (theSheet.GetDraftingViews.Length = 0) Then
Return True
End If
I changed your code as below, It is not working, I am using NX11, can you please let me know what is the issue?
Imports System
Imports NXOpen
Imports NXOpen.UF
Module NXJournal
Public theSession As Session = Session.GetSession()
Public workpart As Part = theSession.Parts.Work
Public theUFSession As UFSession = UFSession.GetUFSession
Sub Main (ByVal args() As String)
For Each theSheet as Drawings.DrawingSheet In workPart.DrawingSheets
theSheet.Open()
Dim sheetTag As NXOpen.Tag = theSheet.View.Tag
Dim sheetObj As NXOpen.Tag = NXOpen.Tag.Null
theUfSession.View.CycleObjects(sheetTag, UFView.CycleObjectsEnum.VisibleObjects, sheetObj)
If (sheetObj = NXOpen.Tag.Null) And (theSheet.GetDraftingViews.Length = 0) Then
MsgBox(theSheet.Name())
End If
Next
The code works for me. Perhaps we have different ideas of the definition of a "blank" sheet. My code looks for a sheet with nothing on it (no title block, no borders, no views, no dimensions, no notes, nothing).
re: identify empty drawing sheets
There's probably a better way, but this is the code that I've been using:
Private Function IsSheetEmpty(ByVal theSheet As Drawings.DrawingSheet) As Boolean
theSheet.Open()
Dim sheetTag As NXOpen.Tag = theSheet.View.Tag
Dim sheetObj As NXOpen.Tag = NXOpen.Tag.Null
_theUfSession.View.CycleObjects(sheetTag, UFView.CycleObjectsEnum.VisibleObjects, sheetObj)
If (sheetObj = NXOpen.Tag.Null) And (theSheet.GetDraftingViews.Length = 0) Then
Return True
End If
Return False
End Function
Thanks For your reply,
Thanks For your reply,
I changed your code as below, It is not working, I am using NX11, can you please let me know what is the issue?
Imports System
Imports NXOpen
Imports NXOpen.UF
Module NXJournal
Public theSession As Session = Session.GetSession()
Public workpart As Part = theSession.Parts.Work
Public theUFSession As UFSession = UFSession.GetUFSession
Sub Main (ByVal args() As String)
For Each theSheet as Drawings.DrawingSheet In workPart.DrawingSheets
theSheet.Open()
Dim sheetTag As NXOpen.Tag = theSheet.View.Tag
Dim sheetObj As NXOpen.Tag = NXOpen.Tag.Null
theUfSession.View.CycleObjects(sheetTag, UFView.CycleObjectsEnum.VisibleObjects, sheetObj)
If (sheetObj = NXOpen.Tag.Null) And (theSheet.GetDraftingViews.Length = 0) Then
MsgBox(theSheet.Name())
End If
Next
End Sub
End Module
re: identify empty drawing sheets
The code works for me. Perhaps we have different ideas of the definition of a "blank" sheet. My code looks for a sheet with nothing on it (no title block, no borders, no views, no dimensions, no notes, nothing).
Thanks for reply, I will
Thanks for reply, I will check