get_levelfromprojectnull_by_floorindexandlevel
Knowing the index of the floor and the height from the level of this floor (may be with a minus), get the height from the zero of the project.
Call:
ac_request("get_levelfromprojectnull_by_floorindexandlevel", int floorInd, double bottomOffset, double &levelfromprojectnull);
Here:
floorind - floor index,
bottomOffset - offset relative to the level of this floor,
levelfromprojectnull - result - vertical offset relative to project zero.
Example:
Select elements from the project.
For elements of type Morph, define the distance of the middle of the element from level 0 of the project.
Option 1. First, a selection of all elements, then, in the course of polling the elements, we determine the necessary ones by type.
// load from the project into list 1 all elements that have any value of the ARCHICAD classifier assigned (optional)
ac_request_special("add_elements_list", 1, "ZombieType", 2,
"", "Cls", "Classificaton ARCHICAD", "ASSIGNED", "", "");
// request the number of items collected
ac_request("get_loaded_elements_list_count", 1);
int icount = ac_getnumvalue(); // get quantity into variable
coutvar << icount; // display in message box
if (icount == 0)
{
cout << "There are no items in the list";
return -1;
}
// declare the necessary variables for work
double dLevel, dHeight, elemlevel, elemprojectlevel;
int ielemstoreindex;
string sElemTypeName, sID;
int i;
int ires;
// loop icount times
for (i = 0; i < icount; i++)
{
ires = ac_request("set_current_element_from_list", 1, i); // make the i-th element from list 1 current
ac_request("get_element_value", "TypeName"); // query the type name of this element
sElemTypeName = ac_getstrvalue();
coutvar << sElemTypeName; // display element type name in message box
// if this is an element of type Morph:
if (sElemTypeName == "MorphType")
{
ires = ac_request("get_element_value", "ID"); // request element ID
sID = ac_getstrvalue(); // get it into a variable
coutvar << sID; // display ID in message box
ires = ac_request("get_element_value", "Level"); // request the Level property (for Morph - the height above the level of its floor)
dLevel = ac_getnumvalue(); // get it into a variable
coutvar << dLevel; // display in the message window
ires = ac_request("get_quantity_value", "max_height"); // request maximum vertical Morph size
dHeight = ac_getnumvalue(); // get it into a variable
coutvar << dHeight; // display in the message window
elemlevel = dLevel + dHeight / 2; // calculate the level of the Morph center by height relative to the floor
ac_request("get_element_value", "StoreIndex"); // request floor index
ielemstoreindex = ac_getnumvalue(); // get the floor index into a variable
// get the height of the Morph center relative to project 0 into the elemprojectlevel variable
ac_request("get_levelfromprojectnull_by_floorindexandlevel", ielemstoreindex, elemlevel, elemprojectlevel);
coutvar << elemprojectlevel; // display in the message window
}
}
Option 2. Immediately select only elements of the Morph type, which are classified as "Stairs"
// load elements of the Morph type from the project into list 1, which have the value of the ARCHICAD classifier "Stairs"
ac_request_special("add_elements_list", 1, "MorphType", 2,
"", "Cls", "Classification ARCHICAD", "=", "Stair", "");
// request the number of items collected
ac_request("get_loaded_elements_list_count", 1);
int icount = ac_getnumvalue(); // get the amount into a variable
coutvar << icount; // display in the message box
if (icount == 0)
{
cout << "The list does not contain elements of type Morph classified as \"Stairs\"";
return -1;
}
// declare the necessary variables for work
double dLevel, dHeight, elemlevel, elemprojectlevel;
string sID;
int ielemstoreindex;
int i;
int ires;
// loop icount times
for (i = 0; i < icount; i++)
{
ires = ac_request("set_current_element_from_list", 1, i); // make the i-th element from list 1 current
ires = ac_request("get_element_value", "ID"); // request element ID
sID = ac_getstrvalue(); // get it into a variable
coutvar << sID; // display ID in message box
ires = ac_request("get_element_value", "Level"); // request the Level property (for Morph - the height above the level of its floor)
dLevel = ac_getnumvalue(); // get it into a variable
coutvar << dLevel; // display in the message window
ires = ac_request("get_quantity_value", "max_height"); // request maximum vertical Morph size
dHeight = ac_getnumvalue(); // get it into a variable
coutvar << dHeight; // display in the message window
elemlevel = dLevel + dHeight / 2; // calculate the level of the Morph center by height relative to the floor
ac_request("get_element_value", "StoreIndex"); // request floor index
ielemstoreindex = ac_getnumvalue(); // get the floor index into a variable
// get the height of the Morph center relative to project 0 into the elemprojectlevel variable
ac_request("get_levelfromprojectnull_by_floorindexandlevel", ielemstoreindex, elemlevel, elemprojectlevel);
coutvar << elemprojectlevel; // display in the message window
}