How can I load a local webpage in Revit using CefSharp?

How can I load a local webpage in Revit using CefSharp?

ajimenezcu
Participant Participant
417 Views
2 Replies
Message 1 of 3

How can I load a local webpage in Revit using CefSharp?

ajimenezcu
Participant
Participant

Hello, I'm trying to load a local webpage in a Revit command using CefSharp. The problem is that to load a complete directory with HTML, CSS, and JavaScript files, it seems that I need to change the CefSharp settings using the Cef.Initialize(settings) method, which Revit already automatically performs during its initialization. As a result, I'm unable to load my web content in a window within my command.

I've also tried using the LoadHtml function, but it doesn't load the styles and scripts of my webpage. Is there any way to load a local webpage using CefSharp in Revit 2023 within a form?

Attached are images of the code:

 

ajimenezcu_0-1686312988858.png

ajimenezcu_1-1686313047924.png

 

0 Likes
Accepted solutions (1)
418 Views
2 Replies
Replies (2)
Message 2 of 3

ricaun
Advisor
Advisor
Accepted solution

I never have a problem opening a local html using CefSharp.

 

If you use the full path of the file should work: C:\Users\webExample\index.html

 

There is no way to overwrite the Revit Cef.Initialize, if exist a way probably gonna break stuff that is used by Revit.

The good part is that your application does not need to initialize Cef and doesn't need to send any Cef dll in your application, like the RevitApi.dll.

 

I created a library/package with all the CefSharp references used in Revit.

 

The project some samples that I used to test like this View with a webpage: https://github.com/ricaun-io/ricaun.Revit.CefSharp/blob/master/ricaun.Revit.CefSharp/Revit/Views/Web...

 

 

 

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 3 of 3

ajimenezcu
Participant
Participant
Thank you, is my fault.
I thought that it was necesary to use LoadHtml method, but you can use Load with a local file.