#A17: Answer: Report drawing views
<?php
using System;
using NXOpen;
using NXOpen.Drawings;
public class NXJournal
{
public static void Main(string[] args)
{
Session theSession = Session.GetSession();
Part workPart = theSession.Parts.Work;
// Access the current drawing sheet
DrawingSheet laSheet = workPart.DrawingSheets.CurrentDrawingSheet;
if (laSheet != null)
{
// Iterate through the drafting views on the current sheet
int drsheetcount = 0;
int drviewcount = 0;
foreach (DrawingSheet vista in workPart.DrawingSheets)
{
// Do something with each drafting view
// For example, print the drafting view name to the console
string drgSheetName = vista.Name;
Guide.InfoWriteLine(" Drawing Sheet Name: " + drgSheetName);
drsheetcount = drsheetcount + 1;
foreach (DraftingView drfview in vista.SheetDraftingViews)
{
string viewName = drfview.Name;
Guide.InfoWriteLine(" Drawing View Name: " + viewName);
drviewcount = drviewcount + 1;
}
Guide.InfoWriteLine("Total Number of Drawing Views: " + drviewcount);
}
Guide.InfoWriteLine("Total Number of Drawing Sheets: " + drsheetcount);
}
else
{
Guide.InfoWriteLine("No drawing sheet is active.");
}
}
}