Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Change backgroud color 2

Status
Not open for further replies.

niedzviedz

Mechanical
Apr 1, 2012
307
Hello,

Does anyone know name of function to change background color of work part? I have many parts with background I don't like, so I wanna write journal to change them automatically.

With best regards
Michael
 
Replies continue below

Recommended for you

Code:
Dim rgbcolour(2) As Double
rgbcolour(0) = 0.8
rgbcolour(1) = 0.8
rgbcolour(2) = 0.8
ufs.Disp.SetColor(UFConstants.UF_DISP_BACKGROUND_COLOR, UFConstants.UF_DISP_rgb_model, "", rgbcolour)
ufs.Disp.LoadColorTable()

Mike Hyde
NX8.5 with TC9.1
Moving to NX10 with TC11.2
 
Thanks,

but it only change color for plain background. I wanna change also for graduated.
I have found this class, but I dont know how to use it to work.
Code:
NXOpen.Display.Background.BackgroundType = Background.Type.Graduated
NXOpen.Display.Background.settopcolor
NXOpen.Display.Background.setbottomcolor


With best regards
Michael
 
There is a interactive method that requires no programming at all :)
1)Open a part file in which you like the color settings.
2) Open the "Roles palette"
3) RMB in the "whitespace" in the roles palette, -"new palette". The result is a new , empty, palette.
4) in the new palette : RMB- New entry - Visualization template, a new dialog will open, DESELECT all options except the "backgrounds".
IF you enable all options in this dialog, the visualization template will push ALL these settings into your next part, include current zoom/rotation etc.
also note that you can change the colors in this dialog.
OK

5) open the part where you like to change the background. Click the visualization template. Done. ( even simpler than running a program :)

Regards,
Tomas
 
Thanks @Toost,

Your method is simpler than select preferences - background - default. But I have many files - about 100 or more, so I wanted create journal to process whole directory for me :).

With best regards
Michael
 
Perhaps you can create a journal that processes all the files in a directory and applies the visualization template to each...

www.nxjournaling.com
 
I thought about it, but when I recorded journal, I get nothing.

With best regards
Michael
 
Hi Toost,

This process does not capture the preferences set for Drafting.. is there similar way to save the preferences ( color and arrow head / font style etc) ?
 
I ran into the same problem. no journal, so for myself, I just made a simple macro and created a user command then stuck it in the Background Color drop down. Black and white.

But now I will try Toost visualization template. I always wanted too, so thanks

CSBK
 
Here is some code to change background color to plain:
Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF 


Module Module1

    Dim theSession As Session = Session.GetSession()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim workPart As Part = theSession.Parts.Work
    Dim rgb1(2) As Double
    Dim rgb2(2) As Double 	

    Sub Main()

        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()


rgb1(0) = Math.Round(35.0/255.0, 7)
rgb1(1) = Math.Round(35.0/255.0, 7)
rgb1(2) = Math.Round(75.0/255.0, 7)


ufs.Disp.SetColor(UFConstants.UF_DISP_BACKGROUND_COLOR, UFConstants.UF_DISP_rgb_model, "", rgb1)
ufs.Disp.LoadColorTable() 

    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

    End Function

End Module


With best regards
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor