×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

NXOpen automating changing background colour and graduation

NXOpen automating changing background colour and graduation

NXOpen automating changing background colour and graduation

(OP)
Hello NXers,

We are upgrading from NX4 to NX10 and all the existing files have black backgrounds, white as the selection colour and the old colour palettes.

I am doing a journal to change these in one operation. The current look is a bit too 90s AutoCAD.

This previous post discusses this: thread561-246693: NXOpen Automating switching to Plain background?

This NXOpen class looks promising: NXOpen.Display.Background.BackgroundType = Background.Type.Graduated;

My question is how do I get the instance of the current Display class object? I need that object to call the function above.

From the BasePart.Views() ViewCollection? Does the Part or the ViewCollection own the Display object?

Thanks

Paul

Paul Turner
CAD & Process Engineer
Mastip Technology

RE: NXOpen automating changing background colour and graduation

Display in this case is just a package, not an object, so you just use the Background class by specifying the package hierarchy:

CODE -->

NXOpen.Display.Background 
However, looking at the Background class, it states:

Represents a Background. Background defines how background pixels are displayed. The background resides on a virtual plane at the back of a view. This background is used for display in Studio rendering style and High Quality Images.  

So I'm not sure its exactly what you're looking for.

Graham Inchley, Systems Developer, Sandvik Coromant. www.sandvik.com
HP EliteBook 8760w, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP4 64bit
Testing: NX9.0.2.5

RE: NXOpen automating changing background colour and graduation

(OP)
Hi Graham,

Thanks for the reply.

I need an object reference to be able to set its BackgroundType.

I can't just call:

NXOpen.Display.Background.BackgroundType = Background.Type.Graduated

So my question is how do I get the object reference for the current display?

Paul Turner
CAD & Process Engineer
Mastip Technology

RE: NXOpen automating changing background colour and graduation

OK, it seems I was a bit hasty saying you could just call the Background methods directly.
To set the background type this is what I did:

CODE --> Java

View workView = theSession.parts().work().views().workView();
Background bg = theSession.parts().work().views()
	.createBackground(workView, true);
bg.setBackgroundType(Type.PLAIN);
bg.commit();
bg.destroy();
workView.setRenderingStyle(View.RenderingStyleType.STUDIO); 
However, as I said in my first post, this is only relevant to views rendered using the Studio or High Quality Image options.
Simple modelling views are not affected.

Looking at the other thread you referenced I can set the background color for normal model views using the wrapper for
UF_DISP_set_color(), but it only changes it for 'Plain' backgrounds. If the view background is 'Graduated' the change is
not seen:

CODE --> Java

double[] rgb = new double[3];
// Red
rgb[0] = 100.0 / 255.0;
// Green
rgb[1] = 100.0 / 255.0;
// Blue
rgb[2] = 200.0 / 255.0;
theUfSession.disp().setColor(0, UFConstants.UF_DISP_rgb_model,
		"MYCOLOR", rgb); 
But I can't find a way to change normal model views between Plain and Graduated using the API.

Graham Inchley, Systems Developer, Sandvik Coromant. www.sandvik.com
HP EliteBook 8760w, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP4 64bit
Testing: NX9.0.2.5

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources