Choose your top Archicad wishes!

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

Switch to 3D view through API

I would like the functionality in my add-on to switch database/window to a 3D View from the Project Navigator. I have tried to use APIDo_GoToViewID, with the guid of a NavigatorItem of type API_ProjectMap and API_PublicViewMap, but the function keeps returning APIERR_BADPARS. I have also tried parsing the guid to a const char*, but with no luck.

Is APIDo_GoToViewID even possible to use with 3D views or is it only drawings?

I have also taken a look at the Navigator_Test example, but it seems like a lot of work switching to the 3D model window and thereafter applying all the view settings (LayerCombinations, DrawingScale and so on...) of the NavigatorViewItem.

What is the simplest way of showing a 3D View in the 3D model window through the API?
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni

If you want to open a 3D window, not a specific 3D view, then these lines will do the trick for you:
API_WindowInfo newWindowInfo = {};
newWindowInfo.typeID = APIWind_3DModelID;
ACAPI_Automate (APIDo_ChangeWindowID, &newWindowInfo);
Hi, thanks for replying!

But if I want to switch to a specific 3D view, is this then possible? I can't seem to retrieve a database for a specific 3D view. The only way I've found is to apply the different viewsettings one by one, for whatever 3D context you are in. This however, seems a little overkill because I also have to reset the settings. Switching to the 3D window seems to open the most recent 3D view, but I would prefer not to tamper with any of the 3D views.

Hi gunners6522!

I also have/had the same problems you  described above, I received APIERR_BADPARS error when trying the function.

I think I found the solution by trial and error. I just used the GUID of the view (API_NavigatorItem guid) converted it into GS::Guid and then to const char*.

It did the job for me! This way I can open views from the ProjectNavigator.