Service alert: BIMcloud SaaS disruption in the US Read more

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

How to switch to 3d window by ACAPI?

sxs
Contributor

Hi,everyone:

 

GSErrCode err = ACAPI_Sight_SelectSight (nullptr, &origSight);
if (err != NoError) {
	ErrorBeep ("Cannot switch to the 3D sight", err);
	return err;
}

 

  I  try this to switch to the 3d window, but it does not work.

 

sxs_0-1748412849581.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
sxs
Contributor
{
		API_WindowInfo      windowInfo;
		API_DatabaseInfo    origDB, planDB;
		API_Element         element;
		GS::Array<API_Guid> elemList;
		GSErrCode           err;

		BNZeroMemory(&planDB, sizeof(API_DatabaseInfo));
		planDB.typeID = APIWind_3DModelID;

		//ACAPI_Database(APIDb_GetCurrentDatabaseID, &origDB, nullptr);
		ACAPI_Database_ChangeCurrentDatabase(&planDB);
		//
		BNZeroMemory(&windowInfo, sizeof(API_WindowInfo));
		windowInfo.typeID = APIWind_3DModelID;
		windowInfo.databaseUnId = planDB.databaseUnId;
		err = ACAPI_Window_ChangeWindow(&windowInfo);
	}

   this can work.

View solution in original post

6 REPLIES 6

Call ACAPI_Database_ChangeCurrentDatabase passing APIWind_3DModelID as the API_DatabaseInfo.typeID

Ralph Wessel BArch
Central Innovation

sxs_1-1748500540076.png

 

This API still has no effect, but the return value is NoError. Is it related to my ArchiCad currently running DEMO status?

 

sxs_0-1748500445046.png

 

Solution
sxs
Contributor
{
		API_WindowInfo      windowInfo;
		API_DatabaseInfo    origDB, planDB;
		API_Element         element;
		GS::Array<API_Guid> elemList;
		GSErrCode           err;

		BNZeroMemory(&planDB, sizeof(API_DatabaseInfo));
		planDB.typeID = APIWind_3DModelID;

		//ACAPI_Database(APIDb_GetCurrentDatabaseID, &origDB, nullptr);
		ACAPI_Database_ChangeCurrentDatabase(&planDB);
		//
		BNZeroMemory(&windowInfo, sizeof(API_WindowInfo));
		windowInfo.typeID = APIWind_3DModelID;
		windowInfo.databaseUnId = planDB.databaseUnId;
		err = ACAPI_Window_ChangeWindow(&windowInfo);
	}

   this can work.

kolioi
Booster

You can use also ACAPI_View_GoToView()

 


@sxs wrote:

This API still has no effect, but the return value is NoError. Is it related to my ArchiCad currently running DEMO status?

 


When you say it has no effect, do you mean you don't see the view come to the front? If so, this isn't what ACAPI_Database_ChangeCurrentDatabase does. It makes the 3D window the current database for all following API commands that concern a specific database, e.g. ACAPI_View_Rebuild

If you simply want to bring the view to the front, use ACAPI_Window_ChangeWindow, but I don't think that's what you want to do in the context of a notification handler

Ralph Wessel BArch
Central Innovation

Ok,I got it

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!