NXOpen Automating switching to Plain background?
NXOpen Automating switching to Plain background?
(OP)
thread561-220758: Open CDF
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.





RE: NXOpen Automating switching to Plain background?
What you might want to do if you simply don't like the system defaults out of the box is to go through and change the template parts and some of the scratch part files used in translations.
Best Regards
Hudson
www.jamb.com.au
Nil Desperandum illegitimi non carborundum
RE: NXOpen Automating switching to Plain background?
Have the macro change the background then fire the program.
I was hoping for a way to have the whole thing programmed but I guess that is not possible at this stage.
RE: NXOpen Automating switching to Plain background?
RE: NXOpen Automating switching to Plain background?
Sometimes I wonder whether it wouldn't in fact be preferable if some of the background, line width, selection colours and Colour Palettes in general weren't defined within the system as user specific setting rather than properties of the part files. It seems to me that in that manner you could satisfy everybody at once and dispense with the hassle of setting and resetting these defaults. I swear that some users must be colour blind by the colours that they make things, and in fact that may well be the case and a serious issue for some users.
Best Regards
Hudson
www.jamb.com.au
Nil Desperandum illegitimi non carborundum
RE: NXOpen Automating switching to Plain background?
John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Cypress, CA
http://www.siemens.com/plm
http://www.plmworld.org/museum/
To an Engineer, the glass is twice as big as it needs to be.
RE: NXOpen Automating switching to Plain background?
Background.BackgroundType = Background.Type.Plain;
Suresh
www.technisites.com.au
RE: NXOpen Automating switching to Plain background?
I am in the process of being upgraded to 6 so will let you know as soon as I can test it. But as long as it does exactly what it says on the tin it would seem to be the exact thing that I was looking for.
Thanks very much.