Code:
using System;
using System.Collections.Generic;
using System.Text;
using NXOpen;
using NXOpen.UF;
using NXOpen.Annotations;
using NXOpen.Assemblies;
namespace DeleteOldTitleBlockNotes
{
class Journal
{
static Session theSession;
static UFSession theUFSession;
static UI theUI;
static Part workPart;
public static void Main(string[] args)
{
theSession = Session.GetSession();
theUFSession = UFSession.GetUFSession();
theUI = UI.GetUI();
workPart = theSession.Parts.Work;
if (workPart.ComponentAssembly.RootComponent != null)
{
var children = workPart.ComponentAssembly.RootComponent.GetChildren();
theSession.ListingWindow.Open();
foreach (var item in children)
{
Part current = item.Prototype as Part;
if (current != null)
{
theSession.ListingWindow.WriteLine("Name: " +
current.FullPath +
"Anzahl Exp: " +
current.Expressions.ToArray().Length);
}
}
}
}
}
}