neshom
Mechanical
- Feb 7, 2016
- 43
I am new user and this is my first journal.
I'd like to have a button to set the translucency of the selected part to 70%. I have recorded the following journal, but it basically does it only for the part that was selected during the record procedure:
Could you please guide me on how I can change it so that it validates the variable component1 to the selected part instead of the part named "model3"?
Thanks in advance.
I'd like to have a button to set the translucency of the selected part to 70%. I have recorded the following journal, but it basically does it only for the part that was selected during the record procedure:
Code:
using System;
using NXOpen;
public class NXJournal
{
public static void Main(string[] args)
{
NXOpen.Session theSession = NXOpen.Session.GetSession();
NXOpen.Part workPart = theSession.Parts.Work;
NXOpen.Part displayPart = theSession.Parts.Display;
// ----------------------------------------------
// Menu: Edit->Object Display...
// ----------------------------------------------
NXOpen.Session.UndoMarkId markId1;
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Edit Object Display");
NXOpen.DisplayModification displayModification1;
displayModification1 = theSession.DisplayManager.NewDisplayModification();
displayModification1.ApplyToAllFaces = true;
displayModification1.ApplyToOwningParts = false;
displayModification1.NewTranslucency = 79;
NXOpen.DisplayableObject[] objects1 = new NXOpen.DisplayableObject[1];
NXOpen.Assemblies.Component component1 = (NXOpen.Assemblies.Component)workPart.ComponentAssembly.RootComponent.FindObject("COMPONENT model3 1");
objects1[0] = component1;
displayModification1.Apply(objects1);
displayModification1.Dispose();
// ----------------------------------------------
// Menu: Tools->Journal->Stop Recording
// ----------------------------------------------
}
public static int GetUnloadOption(string dummy) { return (int)NXOpen.Session.LibraryUnloadOption.Immediately; }
}
Could you please guide me on how I can change it so that it validates the variable component1 to the selected part instead of the part named "model3"?
Thanks in advance.