Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NXOpen Automating switching to Plain background?

Status
Not open for further replies.

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.


 
Replies continue below

Recommended for you

Yes but you could put a macro under an icon and run everything that you need from there.

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
 
Yes that would be a possible workaround.
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.
 
I seem to remember that there may be and action on part open that could similarly run a macro as some kind of possibility, but I omitted discussing it because it doesn't capture the components of an assembly in any case.

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
 
Yes, using Menuscripts you can add pre- and post- actions to any menu item in NX. These can be any executable programs or other application as long as you can launch it from a command-line.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Now that sounds extremely promising!

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor