Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

selection color (load customer defaults)

Legend
Legend

Hello,

 

We have some old parts where the color (preselection / selection) is different than defined in the customer defaults.

Is there a simple way to get colors loaded from the customer defaults?

 

Thanks!

Thomas

 

 

 

7 REPLIES 7

Re: selection color (load customer defaults)

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi @TomK76 ,

 

So you want to change this settings for all parts and save them? Are they on disk?

Regards,
Samadhan

GTAC | NX Help: NX1102 | NX1202 | NX1847
Please mark post as an "Accepted Solution", if it answers your question/is more helpful!

Re: selection color (load customer defaults)

Legend
Legend

Hi @SamadhanGaikwad 

 

these files are in TC. 

At the moment the only way I know is to change the colors manually.

I would like to automate this.

 

Regards,

Thomas

 

 

Re: selection color (load customer defaults)

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi @TomK76 ,

 

Create a .vb file and copy-paste below and run it. Please change the colors as needed.

 

Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String) 

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work

Dim displayPart As NXOpen.Part = theSession.Parts.Display

Dim currentMode1 As NXOpen.Preferences.SessionVisualizationHighEndRendering.MaterialEditorEditingMode = Nothing
currentMode1 = theSession.Preferences.HighEndRenderingVisualization.StudioMaterialEditorEditingMode

workPart.Preferences.ColorSettingVisualization.PreselectionColor = 6

workPart.Preferences.ColorSettingVisualization.SelectionColor = 103

workPart.Preferences.ColorSettingVisualization.HiddenGeometryColor = 125

workPart.Preferences.ColorSettingVisualization.AttentionColor = 186

End Sub
End Module

Regards,
Samadhan

GTAC | NX Help: NX1102 | NX1202 | NX1847
Please mark post as an "Accepted Solution", if it answers your question/is more helpful!

Re: selection color (load customer defaults)

Legend
Legend

Hi @SamadhanGaikwad 

 

Thany you very much, I will try that!!

 

Regards,

Thomas

Re: selection color (load customer defaults)

Siemens Phenom Siemens Phenom
Siemens Phenom

Here is a C# version which reads the colors from customer defaults and sets them in part preferences.

To see the necessary classes and methods, try to record a journal from setting both and combine them as needed.

 

using System;
using NXOpen;

public class ResetSelectionColors
{
 public static void Main(string[] args)
 {
  Session theSession = Session.GetSession();
  Part workPart = theSession.Parts.Work;

  int nPreSelColor = theSession.OptionsManager.GetIntValue("UG_preSelectionColor"); 
int nSelColor = theSession.OptionsManager.GetIntValue("UG_systemColor"); workPart.Preferences.ColorSettingVisualization.PreselectionColor = nPreSelColor; workPart.Preferences.ColorSettingVisualization.SelectionColor = nSelColor ; } }

 

 

Re: selection color (load customer defaults)

Legend
Legend

Hi @Beetle 

 

thanks!

 

I have tried that code, but there comes an error message.

But the code Samadhan wrote works fine!

 

But thanks anyway!!

Regards,

Thomas

Re: selection color (load customer defaults)

Siemens Phenom Siemens Phenom
Siemens Phenom
@TomK76 wrote:

 

I have tried that code, but there comes an error message.

The code executes fine from NX10.0.3 until NX1867.

You did not quote the error but, for example, you cannot copy/paste the code into the journal editor with standard settings because VB is the default language.

Either you change the journaling language in the user preferences to C# before pasting and running C# code from the Journal Editor or you save the code as *.cs and open the file in the Journal Editor (Alt+F11).

As an alternative, execute it from the Journal Manager (Alt+F8).