Ejemplo n.º 1
0
 /// <summary>
 /// 取得子Comp集合(只找下一層)
 /// </summary>
 /// <param name="compAry"></param>
 /// <param name="comp"></param>
 /// <returns></returns>
 public static bool GetCompChildren(out List <NXOpen.Assemblies.Component> compAry, Component comp = null)
 {
     compAry = new List <NXOpen.Assemblies.Component>();
     try
     {
         CaxAsm.SetWorkComponent(comp);
         Part rootPart = theSession.Parts.Work;
         NXOpen.Assemblies.ComponentAssembly casm        = rootPart.ComponentAssembly;
         NXOpen.Assemblies.Component[]       tempCompAry = casm.RootComponent.GetChildren();
         compAry.AddRange(tempCompAry.ToList());
     }
     catch (System.Exception ex)
     {
         //compAry = null;
         return(false);
     }
     return(true);
 }