/// <summary> /// 获取视图 /// </summary> /// <returns></returns> public void SetViewShow() { UFSession theUFSession = UFSession.GetUFSession(); List <NXOpen.Assemblies.Component> allComt = new List <NXOpen.Assemblies.Component>(); List <NXOpen.Assemblies.Component> show = new List <NXOpen.Assemblies.Component>(); show.AddRange(HostComp); show.AddRange(OtherComp); foreach (NXOpen.Assemblies.Component ct in workPart.ComponentAssembly.RootComponent.GetChildren()) { NXOpen.Assemblies.Component[] des = ct.GetChildren(); if (des.Length > 0) { allComt.AddRange(des); foreach (NXOpen.Assemblies.Component com in des) { com.Unblank(); } show.Add(ct); //EDM组件 ct.Unblank(); continue; } allComt.Add(ct); ct.Blank(); } try { ModelingView workView = ViewUtils.SetWorkViewForName("work"); if (workView == null) { workView = ViewUtils.CreateView("work", this.Work.Info.Matr.GetMatrix3()); } AssmbliesUtils.HideComponent(null, allComt.ToArray()); AssmbliesUtils.ShowComponent(null, show.ToArray()); ViewUtils.SetWorkViewForName("Isometric"); } catch (NXException ex) { } }