×
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

Change backgroud color
2

Change backgroud color

Change backgroud color

(OP)
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

RE: Change backgroud color

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
www.astonmartin.com
NX8.5 with TC9.1
Moving to NX10 with TC11.2

RE: Change backgroud color

(OP)
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

RE: Change backgroud color

2
There is a interactive method that requires no programming at all smile
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 smile

Regards,
Tomas

RE: Change backgroud color

(OP)
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

RE: Change backgroud color

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

www.nxjournaling.com

RE: Change backgroud color

(OP)
I thought about it, but when I recorded journal, I get nothing.

With best regards
Michael

RE: Change backgroud color

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) ?

RE: Change backgroud color

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

RE: Change backgroud color

(OP)
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

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