Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Changing NX background to default background ( Backgroundtype= graduated)

Hello All,

 

Could you please help me by providing the .Net code for changing NX background (Which is not set as default background) to default background?

 

I tried writing below code. But it's not happenning.

Thanks in advance!

 

Dim workView As View = theSession.Parts().Work().Views().WorkView
Dim bg As Background = theSession.Parts().Work().Views().CreateBackground(workView, True)
bg.BackgroundType = Background.Type.Graduated

Dim bC As Double() = {1, 0, 0}
bg.SetBottomColor(bC)
Dim TC As Double() = {0, 1, 1}
bg.SetTopColor(TC)

bg.Commit()
bg.Destroy()
workView.RenderingStyle = View.RenderingStyleType.ShadedWithEdges
workView.UpdateDisplay()

9 REPLIES

Re: Changing NX background to default background ( Backgroundtype= graduated)

The .CreateBackground method changes the settings for the studio rendering and rendering "high quality images". If you want to change the background of a shaded or wireframe modeling view, you will need to look elsewhere.

Re: Changing NX background to default background ( Backgroundtype= graduated)

Thanks for your support. 

If .Createbackground is only for changing high quality image, then which one will be the correct API to change the graduated color? 

 

I have attached two images for better understanding.

First one shows how it is now.

Second images shows how I want. 

 

I just want to change the "TOP COLOR" and "BOTTOM COLOR" through code.

I got some code to change the background color if it is Backgroundtype.plain.But it's not happening for Backgroundtype.graduated.

 

Please help.

 

 

Re: Changing NX background to default background ( Backgroundtype= graduated)

Have you  looked into the "NX Open C++ Reference Guide"?  There I found the NXOpen:Smiley Very Happyisplay::Background Class Reference.

 

This has methods you can use to :

SetBackgroundType (NXOpen:Smiley Very Happyisplay::Background::Type backgroundType)

SetBottomColor (const std::vector< double > &bottomColor)

SetTopColor (const std::vector< double > &topColor)

 

Hope that helps.

 

Dave

Dave Figurski

GSS / Siemens Industry Sector

Re: Changing NX background to default background ( Backgroundtype= graduated)

Hi Dave,

 

Thanks for your contribution.

But if you see my first post, there I have added the same code in VB.NET as you said it in C++. 

Still it's not happenning.

 

Re: Changing NX background to default background ( Backgroundtype= graduated)

Refer back to my first post. The Background class is for changing the settings of the studio rendering and high quality image rendering only; it does nothing for regular shaded or wireframe model views.

Re: Changing NX background to default background ( Backgroundtype= graduated)

I see that now about the STUDIO view.
I found an example on the GTAC solution center. I ran it as a JOURNAL and it worked.
(Sample NX Open .NET Visual Basic program : set current view to plain black background)
Though it did change the DISPLAY to the STUDIO view. I tried to change the journal to use a setting of View.RenderingStyleType.Shaded vs View.RenderingStyleType.Studio and it did not work to set the SHADED VIEW background
I'll keep looking
Dave Figurski

GSS / Siemens Industry Sector

Re: Changing NX background to default background ( Backgroundtype= graduated)

I know that It's not working. What could be the solution for this then?
Instead of 'Background' class what am I supposed to use?

Regards,
Abhishek
Solution
Solution
Accepted by topic author AbhishekP
‎12-28-2016 12:22 AM

Re: Changing NX background to default background ( Backgroundtype= graduated)

This can be easily accomplished by creating a visualization template. You can create and click this in the navigator and it's applied on the displayed part.
Patrick Delisse
KMWE - DutchAero
NX11.0, CAMPOST V22, Vericut 8.0

Re: Changing NX background to default background ( Backgroundtype= graduated)

Thanks! It serves the purpose. I wanted to do it through code. Still, it's a great option to increase productivity,