Page 1 of 1

SW addin and CEF browser

Posted: Mon Jul 04, 2022 4:28 am
by vtal
Hello!

I'm currently working on a C# addin that needs to load a web page that can interact with solidworks.

I managed to load web pages using CefSharp but when using more advanced functions (javascript bindings) there is a conflict with the Cef process embedded into SW (swCefSubProc). The Cef process can only be loaded once and the one that loads is the basic SW version thus I'm missing some CefSharp functions. I tried running different versions of Cef in my addin (including the one used in SW) with no success.
The only solution I found to solve the conflicts is to remove the cef folder from the SW install directory (not a viable solution).

Using the built in version of Cef could be an option but I can't find any documentation on it.

Has anyone here managed to get a fully functional CefSharp implementation in their addin ? Or any other embedded web browser ?

Best regards,

Re: SW addin and CEF browser

Posted: Tue Jul 05, 2022 9:42 am
by JSculley
Microsoft's WebView2 should do the trick.

Re: SW addin and CEF browser

Posted: Wed Jul 06, 2022 3:43 am
by vtal
Thanks for the answer!
I tried WebView2 and it works well.
The only downgrade from CefSharp is the worse object passing from js to c#.

Re: SW addin and CEF browser

Posted: Wed Jul 06, 2022 7:58 am
by AlexLachance
vtal wrote: Mon Jul 04, 2022 4:28 am Hello!

I'm currently working on a C# addin that needs to load a web page that can interact with solidworks.

I managed to load web pages using CefSharp but when using more advanced functions (javascript bindings) there is a conflict with the Cef process embedded into SW (swCefSubProc). The Cef process can only be loaded once and the one that loads is the basic SW version thus I'm missing some CefSharp functions. I tried running different versions of Cef in my addin (including the one used in SW) with no success.
The only solution I found to solve the conflicts is to remove the cef folder from the SW install directory (not a viable solution).

Using the built in version of Cef could be an option but I can't find any documentation on it.

Has anyone here managed to get a fully functional CefSharp implementation in their addin ? Or any other embedded web browser ?

Best regards,
I have a macro that creates a BOM, exports it as text and then sends it to the ERP, it opens a Chrome pop-up with all the information to validate and then push into the ERP. Could that have the answer inside it to your need..?

Re: SW addin and CEF browser

Posted: Thu Jul 07, 2022 8:45 am
by vtal
Maybe, but I managed to implement what I wanted with Webview2, I can now call SW API functions from the browser (by using host objects).
Thanks anyway!