BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Convert Html as Resource and pass it to the DG::Browser.LoadHTML() method?

Joel Buehler
Enthusiast

Hehey evryone! 

 

First of all i have to say that the browser palette rocks! thank you very much archicad guys! 😃 

 

In the Browser Palette example you show how to load a URL into the CEF Browser. 

JoelBuehler_0-1681219295042.png

 

Id like to pass my own local gui that is inside a html page to the Archicad Plugin. For that id like to use the method "LoadHTML" of the DGBrowser Module. 

Im Struggling to convert my html as ressource and pass the string to the LoadHTML() method. 

 

i know that i have to use the ACAPI_​Resource_​GetFixStr method, but i dont understand how i convert a file so i i have the needed chararray? 

 

does anyone have a tipp how i can accomplish that? 

 

JoelBuehler_1-1681219542226.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Joel Buehler
Enthusiast

Hehey evryone.

 

i am not able to create a solution for this problem =(

 

1. i am able to convert a html page to an rc2 ressource with the ResConv.exe

2. i am not able to give the convertet file a usable ressource id  (resId) and a Index. 

 

im starting to think that this is not possible. Furthermore no Example shows how to convert a File Ressource. Evry single Example only converts pictures like svg or png to " GICN" ressources.

 

It is also very annoying that the custom compiler dont tell you waht he doesent like on a grc file. he just tells me: "I dont like the grc file, come again" 😄 

 

if anybody is able to help here, i would be really thankfull. 

 

anyway, i found a workarround:

 

1. I convert with a c# skript the html code to a string that the ressource compiler likes. 

2. that string directyl from the grc file seem to work. even with the javascript part. 

 

JoelBuehler_0-1681982158523.png

 

 

 

code then is kinda easy. just get the fixed string from the ressource with ACAPI_Resource_GetFixString(), convert it to the archicad string and pass that to the LoadHtml method:

 

JoelBuehler_1-1681982284684.png

 

if the char array is not in the right size, archicad crashes without bug repport and anything, so be awere!! 😄 

 

hope this helps for people like me that want to build a offline GUI with html 

 

 

View solution in original post

1 REPLY 1
Solution
Joel Buehler
Enthusiast

Hehey evryone.

 

i am not able to create a solution for this problem =(

 

1. i am able to convert a html page to an rc2 ressource with the ResConv.exe

2. i am not able to give the convertet file a usable ressource id  (resId) and a Index. 

 

im starting to think that this is not possible. Furthermore no Example shows how to convert a File Ressource. Evry single Example only converts pictures like svg or png to " GICN" ressources.

 

It is also very annoying that the custom compiler dont tell you waht he doesent like on a grc file. he just tells me: "I dont like the grc file, come again" 😄 

 

if anybody is able to help here, i would be really thankfull. 

 

anyway, i found a workarround:

 

1. I convert with a c# skript the html code to a string that the ressource compiler likes. 

2. that string directyl from the grc file seem to work. even with the javascript part. 

 

JoelBuehler_0-1681982158523.png

 

 

 

code then is kinda easy. just get the fixed string from the ressource with ACAPI_Resource_GetFixString(), convert it to the archicad string and pass that to the LoadHtml method:

 

JoelBuehler_1-1681982284684.png

 

if the char array is not in the right size, archicad crashes without bug repport and anything, so be awere!! 😄 

 

hope this helps for people like me that want to build a offline GUI with html 

 

 

Learn and get certified!