/// <summary> /// 对象显示调整 /// </summary> /// <param name="objects"></param> public static void DisplayModification(List <DisplayableObject> objects) { var theSession = NXOpen.Session.GetSession(); var workPart = theSession.Parts.Work; NXOpen.DisplayModification displayModification1 = theSession.DisplayManager.NewDisplayModification(); displayModification1.ApplyToAllFaces = true; displayModification1.NewTranslucency = 70; displayModification1.Apply(objects.ToArray()); workPart.ModelingViews.WorkView.RenderingStyle = View.RenderingStyleType.ShadedWithEdges; }
/// <summary> /// 设置对象的透明度 /// </summary> /// <param name="displayableObjects">要设置透明度的对象</param> /// <param name="translucency">透明度值</param> /// <param name="applyToAllFaces">是否应用于所有面</param> /// <param name="applyToOwningParts">是否应用于所属部件</param> public static void SetTranslucency(this DisplayableObject[] displayableObjects, int translucency, bool applyToAllFaces = true, bool applyToOwningParts = false) { NXOpen.DisplayModification displayModification = TheSession.DisplayManager.NewDisplayModification(); displayModification.ApplyToAllFaces = applyToAllFaces; displayModification.ApplyToOwningParts = applyToOwningParts; displayModification.NewTranslucency = translucency; displayModification.Apply(displayableObjects); displayModification.Dispose(); }
/// <summary> /// 更改对象颜色 /// </summary> /// <param name="displayableObjects"></param> /// <param name="color"></param> public static void SetColor(this DisplayableObject[] displayableObjects, int color) { NXOpen.Part displayPart = TheSession.Parts.Display; NXOpen.DisplayModification displayModification = TheSession.DisplayManager.NewDisplayModification(); displayModification.ApplyToAllFaces = true; displayModification.ApplyToOwningParts = false; displayModification.NewColor = color; displayModification.Apply(displayableObjects); displayModification.Dispose(); }