JBit
Mechanical
- Jun 4, 2009
- 4
thread561-220758
I am hoping someone can help me with how I can go about automating a change to the background color in NX 3 upwards.
As part of an automated program I want to change the color to a high contrast one for use in taking a screenshots for presentations.
I know that I can use a Macro to do this, recording the visualization preferences selections, and assign the macro to a button. But I want to do it all within an NX program.
It is tempting to cheat but from what I have been told there is no way to call a macro in a program...
So to go about it correctly I have so far found the following of use.
The wrapped UFunc ufSession.Disp.SetColor
eg in C# using a Double array for Red Green Blue Values you can set the background color. Example code.
double[] rgb = new double[3];
//Red
rgb[0] = Math.Round(100.0/255.0, 7);
//Green
rgb[1] = Math.Round(100.0/255.0, 7);
//Blue
rgb[2] = Math.Round(102.0/255.0, 7);
ufSession.Disp.SetColor(0, NXOpen.UF.UFConstants.UF_DISP_rgb_model, "MYCOLOR", rgb);
This is great and does set the background color but if the model was being displayed in shaded mode this doesn't change anything visually.
Therefore does anyone know a way to make program NX to make it change to plain background?
Are there any other work arounds you can think of? Such as a way to program NX to apply a visualization template such as was talked about on previous threads.
Thanks for your interst.
I am hoping someone can help me with how I can go about automating a change to the background color in NX 3 upwards.
As part of an automated program I want to change the color to a high contrast one for use in taking a screenshots for presentations.
I know that I can use a Macro to do this, recording the visualization preferences selections, and assign the macro to a button. But I want to do it all within an NX program.
It is tempting to cheat but from what I have been told there is no way to call a macro in a program...
So to go about it correctly I have so far found the following of use.
The wrapped UFunc ufSession.Disp.SetColor
eg in C# using a Double array for Red Green Blue Values you can set the background color. Example code.
double[] rgb = new double[3];
//Red
rgb[0] = Math.Round(100.0/255.0, 7);
//Green
rgb[1] = Math.Round(100.0/255.0, 7);
//Blue
rgb[2] = Math.Round(102.0/255.0, 7);
ufSession.Disp.SetColor(0, NXOpen.UF.UFConstants.UF_DISP_rgb_model, "MYCOLOR", rgb);
This is great and does set the background color but if the model was being displayed in shaded mode this doesn't change anything visually.
Therefore does anyone know a way to make program NX to make it change to plain background?
Are there any other work arounds you can think of? Such as a way to program NX to apply a visualization template such as was talked about on previous threads.
Thanks for your interst.