License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

how to get the floor information of a building model

Anonymous
Not applicable
I'm a new Archicad Api developer,I want to know how get the floor information of a building model. I find that these are
element,classification concept in Archicad Api,but no floor or building concept.
How can I solve the problem?
Your advice/suggestoins are appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Ralph Wessel
Mentor
Ok, take a look at using ACAPI_Environment with APIEnv_GetStorySettingsID, e.g.:

	API_StoryInfo storyInfo;
	BNZeroMemory(& storyInfo, sizeof (API_StoryInfo));
	GSErrCode err = ACAPI_Environment(APIEnv_GetStorySettingsID, &storyInfo, nullptr);
		//…get whatever you need from the story data
	BMKillHandle((GSHandle *) &storyInfo.data);
The API_StoryInfo structure will have everything you need.
Ralph Wessel BArch
Software Engineer Speckle Systems

View solution in original post

8 REPLIES 8
Ralph Wessel
Mentor
Sorry, I'm not clear on the question. Do you want the building storey information, e.g. the name, base level and height of each floor in the building?
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Ralph wrote:
Sorry, I'm not clear on the question. Do you want the building storey information, e.g. the name, base level and height of each floor in the building?
yes. .How can I get the Information? thank you
Solution
Ralph Wessel
Mentor
Ok, take a look at using ACAPI_Environment with APIEnv_GetStorySettingsID, e.g.:

	API_StoryInfo storyInfo;
	BNZeroMemory(& storyInfo, sizeof (API_StoryInfo));
	GSErrCode err = ACAPI_Environment(APIEnv_GetStorySettingsID, &storyInfo, nullptr);
		//…get whatever you need from the story data
	BMKillHandle((GSHandle *) &storyInfo.data);
The API_StoryInfo structure will have everything you need.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Thanks.
I have several other problems。
First I can't understant the meaning of 'Database' in API, are theres several 'Database' in a project?
If I need compute the area of a building that contains many floors,should I traverse all elements of the building?e.g like Second,I think a building is a classification that contains many elements in ArchiCad, is the idea right?

Third,how can I construct two buiding in a project?
Ralph Wessel
Mentor
When you say "Building", do you mean as defined by IFC?
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Ralph wrote:
When you say "Building", do you mean as defined by IFC?
except IFC,is there the "Building" concept in Archicad?
Also,I can't understand the meaning of "Database" ?

How can I get all elements in some floor by Archicad API?
Ralph Wessel
Mentor
The ARCHICAD API doesn't really define the concept of a 'building' apart from IFC. We've had to rely on geometric methods to discover the perimeter of a building within a project and then allocate elements to buildings on the basis of containment.

The API doesn't have a formal concept of a database either, at least not in the conventional sense. A database is loosely a collection of homogenous data structures, e.g. all attributes or all elements.

Most API calls don' reference a database – the ones that do are mostly found in the documentation for ACAPI_Database, e.g. APIDb_ChangeCurrentDatabaseID (which changes the active database). Once a database is 'set', other API calls act on that database, e.g. ACAPI_Element_Get to retrieve a specific element.

The element data structure is API_Element. You can determine which floor an element belongs to by inspecting its header, header.floorInd. The details of the floor can be retrieved using the method I described above with APIEnv_GetStorySettingsID.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Ralph wrote:
The ARCHICAD API doesn't really define the concept of a 'building' apart from IFC. We've had to rely on geometric methods to discover the perimeter of a building within a project and then allocate elements to buildings on the basis of containment.

The API doesn't have a formal concept of a database either, at least not in the conventional sense. A database is loosely a collection of homogenous data structures, e.g. all attributes or all elements.

Most API calls don' reference a database – the ones that do are mostly found in the documentation for ACAPI_Database, e.g. APIDb_ChangeCurrentDatabaseID (which changes the active database). Once a database is 'set', other API calls act on that database, e.g. ACAPI_Element_Get to retrieve a specific element.

The element data structure is API_Element. You can determine which floor an element belongs to by inspecting its header, header.floorInd. The details of the floor can be retrieved using the method I described above with APIEnv_GetStorySettingsID.
Thank you very much. I understand it.