#A19: Answer Clean and simplify the code
<?php
using System;
using NXOpen;
using NXOpen.UF;
using NXOpen.Assemblies;
public class NXJournal
{
public static Session theSession = Session.GetSession();
public static UFSession ufs = UFSession.GetUFSession();
public static ListingWindow lw = theSession.ListingWindow;
public static void Main()
{
Part workPart = theSession.Parts.Work;
Part dispPart = theSession.Parts.Display;
lw.Open();
ComponentAssembly c = dispPart.ComponentAssembly;
if (c.RootComponent != null)
{
lw.WriteLine("Assembly: " + c.RootComponent.DisplayName);
lw.WriteLine(" + Active Arrangement: " + c.ActiveArrangement.Name);
foreach (Component child in c.RootComponent.GetChildren())
{
lw.WriteLine("subassembly " + child.GetChildren().Length);
lw.WriteLine(" Active Arrangement: " + child.OwningPart.ComponentAssembly.ActiveArrangement.Name);
}
}
lw.Close();
}
}