Change Part or Assembly background color

 

HI,

seems is not possible with the actual API.

For the impossible, I try to ask the help of SolidEdge GURU!!!

Did you find a way to do this?

Thanks in advance, best regards

Massimo

 

Posted by: Massimo Magris
Post date: 5/28/2009 11:07:21 PM

11 REPLIES

RE: Change Part or Assembly background color

 

Hello Massimo,

 

i am actually programming a tool which creates an assembly and adds .par files an moves them to a fixed psition.

Then I change the view and make a picture with a white background colour!!!

I am using VB.NET in Visual Studio 2005.

Now to your Problem:

My code for changing the background color:

Dim SEApp As SolidEdgeFramework.Application = Nothing

 

 

SEApp = CType(CreateObject("SolidEdge.Application"), SolidEdgeFramework.Application)

SEApp.SetGlobalParameter(SolidEdgeFramework.ApplicationGlobalConstants.seApplicationGlobalColorBackground, 16777215) 

16176290 Solid Edge blue

16777215 white

 

Constant

Value

Description

seColorBlack

0

Black

seColorBlue

16711680

Blue

seColorCyan

16776960

Cyan

seColorDarkBlue

8388608

Dark Blue

seColorDarkCyan

8421376

Dark Cyan

seColorDarkGray

8421504

Dark Gray

seColorDarkGreen

32768

Dark Green

seColorDarkMagenta

8388736

Dark Magenta

seColorDarkRed

128

Dark Red

seColorDarkYellow

32896

Dark Yellow

seColorGreen

65280

Green

seColorLightGray

12632256

Light Gray

seColorMagenta

16711935

Magenta

seColorRed

255

Red

seColorWhite

16777215

White

seColorYellow

65535

Yellow

-----------------------------------------------------

Create your Application and then with "setglobalparameter" you can access the background colour. In the Solide Edge Programmers Help you can find colour constants-numberrs.

I hope the help is useful.

Nice Weekend

BEN

 

 

 

 

 

Posted by: Ben Grundler
Post date: 5/29/2009 4:37:23 AM

RE: Change Part or Assembly background color

 

Massimo,

First of all, this is a very dirty solution. Don't tell anybody i told you  and I'm NOT recommending you this method. Use it only if you are desperating.

 The results are impredictable, depending on your machine characteristics, resources, the file sizes, and any other subject that could influence while running the program (like a rainny weather outside)If you run this, DON'T touch the machine under any circumstances. (re-reading that it seems that my program is a bomb )The reason for this caution is that the only way in know to to achieve what you want is sending keystrokes to Solid Edge with SendKeys, which is NOT the best method at all.It took me 1 hour just to get that one part file could change its background to Gradient.Finally i had to send a keystroke (for example a TAB), wait some time, next key, wait some time, etc... to be able to navigate the Format->View form , select Gradient option and AcceptYou will have to adapt the program to your needs (test - error schema), and don't interact with your machine until finished the process.If something fails in the middle it could end up in not-modified files or in files with any other Format-View modification applied (like perspective, reflections, edge colours, etc)  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oSE As SolidEdgeFramework.Application Dim oDoc As SolidEdgeFramework.SolidEdgeDocument Dim t As Integer = 200 'less than 200 does not work!!! Dim deb As Boolean = True 'To debug. You can deactivate it or use other sleep times. (It didn't work for me if deactivated) Me.Hide() 'Hide the form so the active window is Solid edge oSE = GetObject(, "solidedge.application") 'Connect or create solid edge. oDoc = oSE.ActiveDocument 'Well. Here you would open your file. Now i consider it is already opened. oDoc.Activate() 'You should make sure the se window is the active one. oSE.StartCommand(PartFormatFormatView) 'Activate command Format --> View oSE.DoIdle() 'Wait for the command to finish System.Threading.Thread.Sleep(t) 'And i also wait a little more just-in-case SendKeys.SendWait("{TAB}") 'TAB 15 times to activate the TAB label. I tried Ctrl-Tab twice but it doesn't work If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{TAB}") If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{RIGHT} ") 'Next tab If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("{RIGHT} ") 'Next tab System.Threading.Thread.Sleep(1000) 'Wait 1 second because the combobox of "Predeterminado, Gradiente, etc" takes a little to load SendKeys.SendWait("{TAB}") 'TAB to the combobox If deb Then System.Threading.Thread.Sleep(t) SendKeys.SendWait("G") 'In my Spanish interface i change this way from "Predeterminado" to "Gradiente" in the combobox If deb Then System.Threading.Thread.Sleep(100) SendKeys.SendWait("{ENTER}") 'To accept and dismiss the Format View form 'Here you should save your file 'Open next file... End End Sub

 

Posted by: Julian Guillo
Post date: 5/29/2009 4:52:51 AM

RE: Change Part or Assembly background color

Hi Massimo,

 

if you need a gradient background and not just a solid color you will have to use the ViewStyles collection of the window. The easiest way is to load the view style from a template. It is problematic to switch back to the previous settings after you have applied the style, so if you need to do this you are better off opening a new window to use for processing and then just closing this window at the end.

If all you need is a solid color then as ben said, SetGlobalParameter is the best way to go. However if you need more (gradient, change of 3d view style from solid to wire frame etc) then let me know and I can put some code together for you.

 

Cheers

Calum

 

Posted by: Calum McLellan
Post date: 5/29/2009 4:53:38 AM

RE: Change Part or Assembly background color

 

Sorry,

It seems that the code didn't paste very well.

Here you are a text file with it.

Regards,

Julian

 

Posted by: Julian Guillo
Post date: 5/29/2009 4:57:18 AM

RE: Change Part or Assembly background color

 

Julian,

 

When you're trying to paste code, hit the "Source" button in the editor and paste the code. You also need to wrap code in html tags (minus the spaces).

 

 

... source code ...

 

* I edited your post to show you how to do it.

 

Posted by: Jason Newell
Post date: 5/29/2009 5:07:03 AM

RE: Change Part or Assembly background color

Let's try... Sub Thanks(ByVal message As String, Optional ByVal sender As String = "Julian") MessageBox.Show(String.Format("{0} says: 'Jason, {1}'", sender, message))End SubSub SayThanks() Thanks("You're the one, man")End Sub

 

Posted by: Julian Guillo
Post date: 5/29/2009 6:06:57 AM

RE: Change Part or Assembly background color

 

Wow!!

That's a replay!!!!

THANKS TO ALL OF YOU!

Thats the kind of support, one will ever dream about!!!

regards

Massimo

 

 

 

Posted by: Massimo Magris
Post date: 5/29/2009 7:30:04 AM

RE: Change Part or Assembly background color

Hello,

 

may be I can find some help in this forum. I want to change my background color of an active document. For this I also use the code:

 

objApp.SetGlobalParameter(SolidEdgeFramework.ApplicationGlobalConstants.seApplicationGlobalColorBackground, 16777215)

 

But nothing happens with the active document, until I open an other document or create a new file. Then the background color changes.

What have I to do, that the color changes directly?

 

I search a function like update the globalparameters or update screen or so on.

 

Regards Michael

 

 

Posted by: Michael Leesing
Post date: 9/21/2011 10:32:38 PM

RE: Change Part or Assembly background color

Hello,

 

I found a "dirty" solution for that problem. When I change the Backgroundcolor, I'll open a new file automatically and close it. Then the Backgroundcolor in the active document also changes.

Maybe there is a "better" solution.

 

Best Regards Michael

 

Posted by: Michael Leesing
Post date: 10/4/2011 2:37:14 AM