cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

Archicad C++ API
About Archicad add-on development using the C++ API.

Using the JSON interface from the browser

gcNamirial
Participant

Hello,

i've created a set of commands that are registered in the addon so i can call them with the JSON interface and retrieve some data. I tried to use this logic with a Python script and it's working well.

 

Now i'm creating a dialog with a browser control. I managed to pass the data of the selection in the project to the browser and it's working fine.

The browser loads a page hosted in localhost so i can develop it using nodejs.

To develop without having to open the dialog everytime i'd like to get selection data from a command using the JSON interface. So i created a command that converts that data to JSON (GS::ObjectState) and returns that.

In the page, if the ACAPI functions are not present (when the page is not opened by the dialog but standalone in a browser) i try to fetch the data as in python, with javascript.

The issue is that the browser blocks the call because CORS policies. Archicad has 

http://localhost:19723 and the my page http://localhost:5173/ This is not an issue in python but usually the browser needs the server to have CORS headers to allow this if the addresses are different (different ports are considered so).
Any idea if it's possible to bypass this issue?

 

Thanks

0 REPLIES 0