NX9 - Journal Code to Switch Color Palette to "System" Color Palette?
NX9 - Journal Code to Switch Color Palette to "System" Color Palette?
(OP)
Our templates are set to use the system color palette. However, a lot of files seem to creep up using the wrong palette and this makes many of our components appear the wrong color.
Is there a journal code that will automatically switch the color palette to the system palette when it is ran?
Also, if we set up the Customer Defaults to force everyone to use the system palette, will that change old files to the system color palette when they open them? I dont think so, but I figured I would ask anyway.
Is there a journal code that will automatically switch the color palette to the system palette when it is ran?
Also, if we set up the Customer Defaults to force everyone to use the system palette, will that change old files to the system color palette when they open them? I dont think so, but I figured I would ask anyway.





RE: NX9 - Journal Code to Switch Color Palette to "System" Color Palette?
Public Sub load_color_palette()
Dim rootDir As String = _
Environment.GetEnvironmentVariable("UGII_ROOT_DIR")
Dim colorPalette As String = rootDir & "\ugcolor.cdf"
Dim colorName As String = ""
Dim red As String = ""
Dim green As String = ""
Dim blue As String = ""
Dim rgbColor(2) As Double
Dim thisColor As Integer = 0
Dim textLine As String = ""
Dim lineCounter As Integer = 0
Dim myStream As Stream = Nothing
Try
FileOpen(1, colorPalette, OpenMode.Input)
Do Until EOF(1)
textLine = LineInput(1)
If lineCounter > 3 Then
colorName = textLine.Substring(0, 30)
red = textLine.Substring(34, 8)
green = textLine.Substring(45, 8)
blue = textLine.Substring(56, 8)
rgbColor(0) = red
rgbColor(1) = green
rgbColor(2) = blue
thisColor = lineCounter - 4
ufs.Disp.SetColor(thisColor, _
UFConstants.UF_DISP_rgb_model, colorName, rgbColor)
End If
lineCounter += 1
Loop
FileClose(1)
ufs.Disp.LoadColorTable()
Catch Ex As NXException
s.ListingWindow.Open()
s.ListingWindow.WriteLine("Error in load_color_palette: ")
s.ListingWindow.WriteLine(Ex.GetBaseException.ToString())
End Try
End Sub
RE: NX9 - Journal Code to Switch Color Palette to "System" Color Palette?
what i want? : i want to when click on a but it loads the costumer default palette, or is there a way, like thru the ugii_env, to when i start the NX it automaticly loads the costumer default palette or one that i choose from a dir?
NX8.5 User
RE: NX9 - Journal Code to Switch Color Palette to "System" Color Palette?
The color table is saved with the part. What you specify in the customer defaults will only apply to a newly created (blank) file. Old parts will still use the colors they were saved with.
www.nxjournaling.com
RE: NX9 - Journal Code to Switch Color Palette to "System" Color Palette?
RE: NX9 - Journal Code to Switch Color Palette to "System" Color Palette?
CODE -->
will not return me error if my pallet colors difers from the system default ? i just need to do this? :
CODE -->
Public Sub load_color_palette() Dim rootDir As String = _ Environment.GetEnvironmentVariable("UGII_ROOT_DIR") Dim colorPalette As String = rootDir & "c:\xpto\Mycolors.cdf" Dim colorName As String = "" Dim red As String = "" Dim green As String = "" Dim blue As String = "" Dim rgbColor(2) As Double Dim thisColor As Integer = 0 Dim textLine As String = "" Dim lineCounter As Integer = 0 Dim myStream As Stream = Nothing Try FileOpen(1, colorPalette, OpenMode.Input) Do Until EOF(1) textLine = LineInput(1) If lineCounter > 3 Then colorName = textLine.Substring(0, 30) red = textLine.Substring(34, 8) green = textLine.Substring(45, 8) blue = textLine.Substring(56, 8) rgbColor(0) = red rgbColor(1) = green rgbColor(2) = blue thisColor = lineCounter - 4 ufs.Disp.SetColor(thisColor, _ UFConstants.UF_DISP_rgb_model, colorName, rgbColor) End If lineCounter += 1 Loop FileClose(1) ufs.Disp.LoadColorTable() Catch Ex As NXException s.ListingWindow.Open() s.ListingWindow.WriteLine("Error in load_color_palette: ") s.ListingWindow.WriteLine(Ex.GetBaseException.ToString()) End Try End SubNX8.5 User