Functions related to the Database Manager, creating, manupulating and switching between different databases.
More...
|
struct | API_Region |
| Polygonal or rectangular region of the model. More...
|
|
struct | API_DatabaseUnId |
| Identification parameters of a Section, Detail, Interior Elevation, Worksheet, Master Layout, Layout, and 3D Document window or window related database. More...
|
|
struct | API_ClipTran |
| Defines a transformation for the clipping. More...
|
|
struct | API_WindowValidatorInfo |
| Holds information on elements and custom checksums that should be validated for the window. More...
|
|
|
GSErrCode | ACAPI_Window_GetCurrentWindow (API_WindowInfo *windowInfo) |
| Returns the identifier of the current (active) window.
|
|
GSErrCode | ACAPI_Window_ResetCurrentWindow () |
| Deletes the database elements of the current window and sets up a new, empty environment.
|
|
GSErrCode | ACAPI_Window_NewWindow (API_NewWindowPars *newWindowPars, APICustomWindowHandlerProc *handlerProc=nullptr) |
| Opens a new window.
|
|
GSErrCode | ACAPI_Window_CloseWindow (API_WindowInfo *windowInfo) |
| Closes a window.
|
|
GSErrCode | ACAPI_Window_GetOwnWindows (API_WindowTypeID *windowTypeID, GS::Array< API_Guid > *guid=nullptr) |
| Returns the ids of the opened windows in an array.
|
|
GSErrCode | ACAPI_Database_GetCurrentDatabase (API_DatabaseInfo *databaseInfo) |
| Returns the identifier of the current (active) database.
|
|
GSErrCode | ACAPI_Window_ResetCurrentDatabase () |
| Deletes the database elements of the current window and sets up a new, empty environment.
|
|
GSErrCode | ACAPI_Database_ChangeCurrentDatabase (API_DatabaseInfo *databaseInfo) |
| Changes the current (active) database.
|
|
GSErrCode | ACAPI_Database_RedrawCurrentDatabase () |
| Redraws the current database, even it's associated window is in the background.
|
|
GSErrCode | ACAPI_Database_RebuildCurrentDatabase () |
| Rebuilds the current database, even it's associated window is in the background.
|
|
GSErrCode | ACAPI_Database_NewDatabase (API_DatabaseInfo *databaseInfo, const API_Guid *parent=nullptr, const API_Guid *child=nullptr) |
| Creates a new independent detail, worksheet, layout or master layout database.
|
|
GSErrCode | ACAPI_Database_ModifyDatabase (API_DatabaseInfo *databaseInfo) |
| Modifies the parameters of an independent detail, worksheet, layout or master layout database.
|
|
GSErrCode | ACAPI_Database_DeleteDatabase (API_DatabaseInfo *databaseInfo) |
| Deletes an independent detail, worksheet, layout, or master layout database.
|
|
GSErrCode | ACAPI_Window_GetDatabaseInfo (API_DatabaseInfo *databaseInfo, API_DatabaseUnId *databaseId=nullptr) |
| Retrieves information of the given database.
|
|
GSErrCode | ACAPI_Database_GetDBUnIdFromGuid (API_Guid *elemSetId, short *userId, UInt32 *databaseId) |
| Returns the old database identifiers from the database GUID.
|
|
GSErrCode | ACAPI_Database_GetGuidFromDBUnId (short *userId, UInt32 *databaseId, API_Guid *elemSetId) |
| Returns the GUID from old database identifiers.
|
|
GSErrCode | ACAPI_Database_GetDetailDatabases (API_DatabaseUnId **databaseUnIds, GS::Array< API_DatabaseUnId > *databaseUnIdArray=nullptr) |
| Returns the list of unique IDs of all detail databases.
|
|
GSErrCode | ACAPI_Database_GetLayoutDatabases (API_DatabaseUnId **databaseUnIds, GS::Array< API_DatabaseUnId > *databaseUnIdArray=nullptr) |
| Returns the list of unique IDs of all layout databases.
|
|
GSErrCode | ACAPI_Database_GetMasterLayoutDatabases (API_DatabaseUnId **databaseUnIds, GS::Array< API_DatabaseUnId > *databaseUnIdArray=nullptr) |
| Returns the list of unique IDs of all master layout databases.
|
|
GSErrCode | ACAPI_Window_AddTextWindowContent (API_WindowInfo *windowInfo, const char *content, const GS::UniString *uniContent=nullptr) |
| Adds new lines to the content of a text window.
|
|
GSErrCode | ACAPI_Database_StartClippingSession () |
| Sets up clipping session for newly created elements to be clipped.
|
|
GSErrCode | ACAPI_Database_DoClip (API_Region *clipRegion, API_ClipTran *clipTran=nullptr) |
| Clips the elements created during a clipping session.
|
|
GSErrCode | ACAPI_Database_StopClippingSession () |
| Stops clipping elements.
|
|
GSErrCode | ACAPI_Database_GetLocOrigo (API_Coord3D *locOrigin) |
| Returns the local origin of the current database.
|
|
GSErrCode | ACAPI_Database_GetSectionDatabases (API_DatabaseUnId **databaseUnIds, GS::Array< API_DatabaseUnId > *databaseUnIdArray=nullptr) |
| Returns all the section databases in the project.
|
|
GSErrCode | ACAPI_Database_GetElevationDatabases (API_DatabaseUnId **databaseUnIds, GS::Array< API_DatabaseUnId > *databaseUnIdArray=nullptr) |
| Returns all the elevation databases in the project.
|
|
GSErrCode | ACAPI_Database_GetInteriorElevationDatabases (API_DatabaseUnId **databaseUnIds, GS::Array< API_DatabaseUnId > *databaseUnIdArray=nullptr) |
| Returns all the interior elevation databases in the project.
|
|
GSErrCode | ACAPI_Database_GetWorksheetDatabases (API_DatabaseUnId **databaseUnIds, GS::Array< API_DatabaseUnId > *databaseUnIdArray=nullptr) |
| Returns the list of unique IDs of all detail databases.
|
|
GSErrCode | ACAPI_Database_GetDocumentFrom3DDatabases (API_DatabaseUnId **databaseUnIds, GS::Array< API_DatabaseUnId > *databaseUnIdArray=nullptr) |
| Returns the list of unique IDs of all document 3D databases.
|
|
GSErrCode | ACAPI_Database_GetContainingDatabase (const API_Guid *element, API_DatabaseInfo *dbInfo) |
| Obtains the unique ID of database contains the given element.
|
|
GSErrCode | ACAPI_Database_BuildWindowValidator (const API_WindowValidatorInfo *pValidatorInfo) |
| Registers a new window validator for the given guid.
|
|
GSErrCode | ACAPI_Window_DestroyWindowValidator (const API_Guid *pGuid) |
| Destroys an already registered validator for the given guid.
|
|
GSErrCode | ACAPI_Database_CheckWindowValidator (const API_WindowValidatorInfo *pValidatorInfo, bool *pContentChanged) |
| Cheks the already added list of elements and checksums form the validator (identified by the guid) against the lists from the parameter if there was any changes.
|
|
GSErrCode | ACAPI_Database_RebuildWindowValidator (const API_WindowValidatorInfo *pValidatorInfo) |
| Sets the element and checksum list for an already added validator with given guid.
|
|
GSErrCode | ACAPI_Database_JsonQuery (const GS::UniString *query, GS::UniString *result) |
| Helper function to call various functions inside Archicad.
|
|
GS::Array< API_DatabaseUnId > | ACAPI_Database_GetDatabasesForType (const API_DatabaseTypeID &id) |
| Helper function to collect all Archicad databases of the given type.
|
|
GS::Array< API_DatabaseUnId > | ACAPI_Database_GetDatabasesForTypes (const GS::Array< API_DatabaseTypeID > &ids) |
| Helper function to collect all Archicad databases of the given types.
|
|
Functions related to the Database Manager, creating, manupulating and switching between different databases.
Database Overview
The API enables you to work on the Archicad database. Various functions are present to create, get, modify and also delete elements, attributes and library parts. It is also possible to control the selection of elements, and some settings of the overall environment; for example stories, grid settings, etc.
To read the rules of data structure modifications, please read Command Overview paper.
In this section, some information is provided about how the Virtual Building database is built up, and what the links are among the different components.
Elements
Database items named elements directly appear in one of the project windows. Their parameters can be set in the Settings Dialogs or in the Info Box. Most of them refer to many attributes, some of them to library parts.
API functions operating on elements begin with the ACAPI_Element_ prefix. Refer to the Element Manager to see the whole collection of functions that support element manipulations.
API structures referenced by the handler functions are explained in details in the Element Database document. Refer to this document to get specific information about the data structures related to all element types.
To read general information about elements refer to the Element Overview paper.
Properties
Properties allows one to store user-defined name-value pairs for Model elements.
To read general information about properties refer to the Properties paper.
Classifications
Classifications allows one to classify elements and create custom classifications.
To read general information about classifications refer to the Classification paper.
Attributes
Database items named attributes are global collections of layers, pen colors, surface materials, fill patterns, etc. that are available to all eligible tools. These attribute sets are editable, and the lists and palettes in the Tool Settings dialog boxes display their current settings.
API functions operating on attributes begin with the ACAPI_Attribute_ prefix. Refer to the Attribute Manager to see the whole collection of functions that support attribute manipulations.
API structures referenced by the handler functions are explained in details in the Attribute Database document. Refer to these papers to get specific information about the data structures related to all attribute types.
To read general information about attributes refer to the Attribute Overview paper.
The API also provides a platform-independent way to use those custom controls in Archicad which provide the user a list of certain attributes he can choose from. You can read more on this in the FAQ.
Library Parts
Database items named Library Parts are prefabricated elements which may have instances in the project with different parameters like scaling, rotation, etc. Many elements have a reference to a specific Library Part, like windows, objects, rooms, etc. Library Parts can be created and edited through the Library Part editor dialog. The active library folders can be controlled through the Library Manager... dialog of Archicad. From v4.1, you may receive notification when the loaded libraries change.
API functions operating on a Library Part file begin with the ACAPI_LibraryPart_ prefix. Refer to the Library Part Manager to see the available collection of functions to manage a Library Part file.
API structures referenced by the handler functions are explained in details in the Library document. Refer to these papers to get specific information about the data structures related to a Library Part file.
To read general information about library parts refer to the LibPart Overview paper.
Structural Analytical Model
To read general information about the Structural Analytical Model refer to the Analytical Model Overview paper.
Environment
There are database items which do not fit into any categories listed above, but have influence on the project's appearance and to the behavior of elements; such as the preferences like parameters, the drawing scale, the 3D projection parameters and so on.
◆ API_DatabaseInfo
Identification parameters of a project database.
◆ APICustomWindowHandlerProc
typedef GSErrCode APICustomWindowHandlerProc(const API_Guid &userRefId, API_NotifyWindowEventID notifID) |
User supplied callback function for handling events in windows opened by the add-on.
- Parameters
-
userRefId | [in] The reference GUID of the custom window, as supplied to ACAPI_Window_NewWindow. |
notifID | [in] The type of the event for the custom window. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_Database_BuildWindowValidator()
Registers a new window validator for the given guid.
- Parameters
-
pValidatorInfo | Contains the guid of a window which will be the owner of the new validator and an element and checksum list to track their changes. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - pValidatorInfo is nullptr
- APIERR_MEMFULL - Not enough memory to complete the operation.
- APIERR_GENERAL - There is already a validator registered for this guid.
◆ ACAPI_Database_ChangeCurrentDatabase()
GSErrCode ACAPI_Database_ChangeCurrentDatabase |
( |
API_DatabaseInfo * |
databaseInfo | ) |
|
Changes the current (active) database.
- Since
- Archicad 25
- Parameters
-
databaseInfo | [in] parameters of the database to be created (type, reference index) |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - databasePars is nullptr
- APIERR_NOPLAN - no open project
- APIERR_BADDATABASE - the requested database does not exist
- Example
GSErrCode ChangeCurrentDatabaseToDatabaseOfSectionElement (
const API_Guid& guid)
{
if (err != NoError)
return err;
return Error;
databasePars.
typeID = APIWind_SectionID;
err = ACAPI_Database (APIDb_ChangeCurrentDatabaseID, &databasePars);
return err;
}
GSErrCode ACAPI_Element_Get(API_Element *element, UInt32 mask=0)
Returns information on the main parameters of a given element.
API_SectionSegment segment
Section segment.
Definition: APIdefs_Elements.h:11394
API_Guid guid
The globally unique identifier of the element. It is type-independent, and guaranteed to be globally ...
Definition: APIdefs_Elements.h:426
API_ElemType type
The type of the element.
Definition: APIdefs_Elements.h:407
Represents a GS::Guid in the API layer.
Definition: API_Guid.hpp:46
API_DatabaseUnId databaseID
Database ID to switch to (see API_DatabaseUnId).
Definition: APIdefs_Elements.h:11090
Identification parameters of a project window.
Definition: APIdefs_Database.h:274
API_DatabaseUnId databaseUnId
Section/Elevation/Interior Elevation, Detail and Worksheet database/window unique identifier.
Definition: APIdefs_Database.h:291
API_WindowTypeID typeID
the window/database type identifier
Definition: APIdefs_Database.h:279
A union collecting all known element types.
Definition: APIdefs_Elements.h:17120
API_Elem_Head header
General element header.
Definition: APIdefs_Elements.h:17126
API_CutPlaneType cutPlane
Represents a section.
Definition: APIdefs_Elements.h:17287
◆ ACAPI_Database_CheckWindowValidator()
GSErrCode ACAPI_Database_CheckWindowValidator |
( |
const API_WindowValidatorInfo * |
pValidatorInfo, |
|
|
bool * |
pContentChanged |
|
) |
| |
Cheks the already added list of elements and checksums form the validator (identified by the guid) against the lists from the parameter if there was any changes.
- Parameters
-
pValidatorInfo | Contains the guid of a window which is the owner of the validator and the current, and the element and checksum list to check against. |
pContentChanged | Out paramter for the result. true if there was a change false otherwise. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - pValidatorInfo or pContentChanged is nullptr
- APIERR_MEMFULL - Not enough memory to complete the operation.
- APIERR_GENERAL - There is no validator registered for this guid.
◆ ACAPI_Database_DeleteDatabase()
Deletes an independent detail, worksheet, layout, or master layout database.
- Parameters
-
databaseInfo | [in] parameters of the database to be deleted |
- Returns
- NoError - The function has completed with success.
- APIERR_NOPLAN - no floor plan window opened
- APIERR_BADPARS - api_dbInfo is nullptr, or contains invalid database reference
- APIERR_REFUSEDPAR - the passed typeID is not
APIWind_DetailID
, APIWind_WorksheetID
, APIWind_LayoutID
or APIWind_MasterLayoutID
- APIERR_REFUSEDCMD - attempted to delete database during signing in a Teamwork file
- APIERR_NOTMINE - unsufficient privileges to delete database in Teamwork mode
- APIERR_GENERAL - failed to delete the database
- Example
GSErrCode err = ACAPI_Database (APIDb_GetCurrentDatabaseID, &dbInfo, nullptr);
if (err == NoError && dbInfo.
typeID == APIWind_LayoutID)
ACAPI_Database (APIDb_DeleteDatabaseID, &dbInfo, nullptr);
◆ ACAPI_Database_DoClip()
Clips the elements created during a clipping session.
- Parameters
-
clipRegion | the region to clip elements to |
clipTran | clipping transformation |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - clipRegion is nullptr
- APIERR_NESTING - the clip session is opened for the database
- Example
GSErrCode err;
err = ACAPI_Database (APIDb_StartClippingSessionID, nullptr, nullptr);
if (err == NoError) {
err = ACAPI_Database (APIDb_DoClipID
, &clipRegion, nullptr);
}
err = ACAPI_Database (APIDb_StopClippingSessionID, nullptr, nullptr);
GSErrCode ACAPI_Element_Create(API_Element *element, API_ElementMemo *memo)
Places a new element into current database.
double xMin
Minimum value of the x coordinate of the box.
Definition: APIdefs_Base.h:191
double yMax
Maximum value of the y coordinate of the box.
Definition: APIdefs_Base.h:209
double xMax
Maximum value of the x coordinate of the box.
Definition: APIdefs_Base.h:203
double yMin
Minimum value of the y coordinate of the box.
Definition: APIdefs_Base.h:197
Polygonal or rectangular region of the model.
Definition: APIdefs_Base.h:364
API_Box box
the rectangle (in case rectangular representation)
Definition: APIdefs_Base.h:394
◆ ACAPI_Database_GetContainingDatabase()
Obtains the unique ID of database contains the given element.
- Parameters
-
element | [in] The referred element. |
dbInfo | [out] The owner database ID. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The guid or dbInfo parameter is nullptr.
- APIERR_NOPLAN - There is no open project.
◆ ACAPI_Database_GetCurrentDatabase()
Returns the identifier of the current (active) database.
- Parameters
-
databaseInfo | [out] The identification parameters of the current database |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - databaseInfo is nullptr
- APIERR_BADWINDOW - the type of the current database is not known by the API
- Example
GSErrCode err;
err = ACAPI_Database (APIDb_GetCurrentDatabaseID, &databaseInfo, nullptr);
◆ ACAPI_Database_GetDatabasesForType()
GS::Array< API_DatabaseUnId > ACAPI_Database_GetDatabasesForType |
( |
const API_DatabaseTypeID & |
id | ) |
|
Helper function to collect all Archicad databases of the given type.
- Parameters
-
id | The database type to collect. |
- Returns
- A list of database idetifiers for the given type, or any empty list if no such databases exist in the current project.
◆ ACAPI_Database_GetDatabasesForTypes()
GS::Array< API_DatabaseUnId > ACAPI_Database_GetDatabasesForTypes |
( |
const GS::Array< API_DatabaseTypeID > & |
ids | ) |
|
Helper function to collect all Archicad databases of the given types.
- Parameters
-
ids | List of database types to collect. |
- Returns
- A list of database idetifiers for the given types, or any empty list if no such databases exist in the current project.
◆ ACAPI_Database_GetDBUnIdFromGuid()
GSErrCode ACAPI_Database_GetDBUnIdFromGuid |
( |
API_Guid * |
elemSetId, |
|
|
short * |
userId, |
|
|
UInt32 * |
databaseId |
|
) |
| |
Returns the old database identifiers from the database GUID.
- Parameters
-
elemSetId | [in] Unique identifier of the database. |
userId | [out] First old identifier. |
databaseId | [out] Second old identifier. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - One of the parameters is nullptr.
- Example
ACAPI_Database (APIDb_GetCurrentDatabaseID
, &databaseInfo, nullptr);
UInt32 currentDatabaseId;
short userId;
ACAPI_Database (APIDb_GetDBUnIdFromGuidID
API_Guid elemSetId
Unique identifier.
Definition: APIdefs_Database.h:244
◆ ACAPI_Database_GetDetailDatabases()
Returns the list of unique IDs of all detail databases.
- Parameters
-
databaseUnIds | [out] The list of detail database unique IDs. Note this is not handle; it's the address of a pointer. See the example below. |
databaseUnIdArray | [out] the array of detail databases, in a more recent form. Pass the address of an appropriate GS::Array<> to get the result. This parameter has precedence over the other databaseUnIds parameter. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - dbUnIDs is nullptr
- APIERR_NOPLAN - the plan database does not exist
- Example
The Attribute Manager add-on uses this function to collect all the used attributes from the detail databases.
◆ ACAPI_Database_GetDocumentFrom3DDatabases()
Returns the list of unique IDs of all document 3D databases.
- Parameters
-
databaseUnIds | [out] The list of document 3D database unique IDs. Note this is not handle; it's the address of a pointer. See the example below. |
databaseUnIdArray | [out] the array of 3D document databases, in a more recent form. Pass the address of an appropriate GS::Array<> to get the result. This parameter has precedence over the other databaseUnIds parameter. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - dbUnIDs is nullptr
- APIERR_NOPLAN - the plan database does not exist
- Example
The Attribute Manager add-on uses this function to collect all the used attributes from the document 3D databases.
◆ ACAPI_Database_GetElevationDatabases()
Returns all the elevation databases in the project.
- Parameters
-
databaseUnIds | the array of elevation databases (address of a pointer! not a handle). |
databaseUnIdArray | [out] the array of elevation databases, in a more recent form. Pass the address of an appropriate GS::Array<> to get the result. This parameter has precedence over the other databaseUnIds parameter. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_Database_GetGuidFromDBUnId()
GSErrCode ACAPI_Database_GetGuidFromDBUnId |
( |
short * |
userId, |
|
|
UInt32 * |
databaseId, |
|
|
API_Guid * |
elemSetId |
|
) |
| |
Returns the GUID from old database identifiers.
- Parameters
-
userId | [in] First old identifier. |
databaseId | [in] Second old identifier. |
elemSetId | [out] Unique identifier of the database. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - One of the parameters is nullptr. Or databaseId is 0.
- Example
The Environment Control example add-on uses this function to get floor plan s guid.
◆ ACAPI_Database_GetInteriorElevationDatabases()
Returns all the interior elevation databases in the project.
- Parameters
-
databaseUnIds | the array of interior elevation databases (address of a pointer! not a handle). |
databaseUnIdArray | [out] the array of interior elevation databases, in a more recent form. Pass the address of an appropriate GS::Array<> to get the result. This parameter has precedence over the other databaseUnIds parameter. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_Database_GetLayoutDatabases()
Returns the list of unique IDs of all layout databases.
- Parameters
-
databaseUnIds | [out] The list of layout database unique IDs. Note: this is not handle; it's the address of a pointer. You'll have to dispose it with BMpFree when you don't need it any more. |
databaseUnIdArray | [out] the array of layout databases, in a more recent form. Pass the address of an appropriate GS::Array<> to get the result. This parameter has precedence over the other databaseUnIds parameter. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - dbUnIDs is nullptr
- APIERR_NOPLAN - the plan database does not exist
- Example
See the Example of the APIDb_GetDatabaseInfoID
function.
◆ ACAPI_Database_GetLocOrigo()
GSErrCode ACAPI_Database_GetLocOrigo |
( |
API_Coord3D * |
locOrigin | ) |
|
Returns the local origin of the current database.
- Parameters
-
locOrigin | the local origin |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - locOrigin is nullptr
- APIERR_BADDATABASE - the query is valid only for the plan, section, detail and 3D window.
◆ ACAPI_Database_GetMasterLayoutDatabases()
Returns the list of unique IDs of all master layout databases.
- Parameters
-
databaseUnIds | [out] The list of master layout database unique IDs. Note this is not handle; it's the address of a pointer. |
databaseUnIdArray | [out] the array of master layout databases, in a more recent form. Pass the address of an appropriate GS::Array<> to get the result. This parameter has precedence over the other databaseUnIds parameter. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - dbUnIDs is nullptr
- APIERR_NOPLAN - the plan database does not exist
- Example
See the Example of the APIDb_GetDatabaseInfoID
function.
◆ ACAPI_Database_GetSectionDatabases()
Returns all the section databases in the project.
- Parameters
-
databaseUnIds | the array of section databases (address of a pointer! not a handle). |
databaseUnIdArray | [out] the array of section databases, in a more recent form. Pass the address of an appropriate GS::Array<> to get the result. This parameter has precedence over the other databaseUnIds parameter. |
- Returns
- NoError - The function has completed with success.
◆ ACAPI_Database_GetWorksheetDatabases()
Returns the list of unique IDs of all detail databases.
- Parameters
-
databaseUnIds | [out] The list of worksheet database unique IDs. Note this is not handle; it's the address of a pointer. See the example below. |
databaseUnIdArray | [out] the array of worksheet databases, in a more recent form. Pass the address of an appropriate GS::Array<> to get the result. This parameter has precedence over the other databaseUnIds parameter. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - dbUnIDs is nullptr
- APIERR_NOPLAN - the plan database does not exist
- Example
The Attribute Manager add-on uses this function to collect all the used attributes from the detail databases.
◆ ACAPI_Database_JsonQuery()
GSErrCode ACAPI_Database_JsonQuery |
( |
const GS::UniString * |
query, |
|
|
GS::UniString * |
result |
|
) |
| |
Helper function to call various functions inside Archicad.
- Parameters
-
query | The request towards Archicad |
result | The answer from Archicad |
- Returns
- NoError - The function has completed with success.
- Other error code -
query
is invalid.
◆ ACAPI_Database_ModifyDatabase()
Modifies the parameters of an independent detail, worksheet, layout or master layout database.
- Parameters
-
databaseInfo | [in/out] parameters of the database to be created |
- Returns
- NoError - the function has completed with success.
- APIERR_NOPLAN - no floor plan window opened
- APIERR_BADPARS - databaseInfo is nullptr
- APIERR_REFUSEDPAR - the passed typeID is not
APIWind_DetailID
, APIWind_WorksheetID
, APIWind_LayoutID
or APIWind_MasterLayoutID
- APIERR_REFUSEDCMD - attempted to modify database parameters during signing in a Teamwork file
- APIERR_NOTMINE - unsufficient privileges to modify database parameters in Teamwork mode
- APIERR_GENERAL - failed to modify the database parameters
- Example
GSErrCode err = ACAPI_Database (APIDb_GetCurrentDatabaseID, &dbInfo, nullptr);
if (err == NoError && dbInfo.
typeID == APIWind_LayoutID) {
CHCopyC (
"Renamed Layout", dbInfo.
name);
ACAPI_Database (APIDb_ModifyDatabaseID, &dbInfo, nullptr);
}
GS::uchar_t name[API_UniLongNameLen]
the name of the database (Unicode string)
Definition: APIdefs_Database.h:309
◆ ACAPI_Database_NewDatabase()
Creates a new independent detail, worksheet, layout or master layout database.
- Parameters
-
databaseInfo | [in/out] parameters of the database to be created |
parent | The parent of the new item. |
child | If it is nullptr, then the new item will be inserted to the first place on the actual level, otherwise the it will be inserted after the child. |
- Returns
- NoError - the function has completed with success.
- APIERR_REFUSEDCMD - the function was refused to execute, because it was called inside an undo scope.
- APIERR_NOPLAN - no floor plan window opened
- APIERR_BADPARS - databaseInfo is nullptr
- APIERR_REFUSEDPAR - the passed typeID is not
APIWind_DetailID
, APIWind_WorksheetID
, APIWind_LayoutID
or APIWind_MasterLayoutID
- APIERR_GENERAL - could not create new database
- Example
dbInfo.
typeID = APIWind_DetailID;
sprintf (dbInfo.
name,
"Dooku 1");
sprintf (dbInfo.
ref,
"D01");
if (ACAPI_Database (APIDb_NewDatabaseID, &dbInfo, nullptr) == NoError) {
char msgStr[1024];
}
void ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.
GS::uchar_t ref[API_UniLongNameLen]
reference string/id of the database
Definition: APIdefs_Database.h:315
◆ ACAPI_Database_RebuildCurrentDatabase()
GSErrCode ACAPI_Database_RebuildCurrentDatabase |
( |
| ) |
|
Rebuilds the current database, even it's associated window is in the background.
- Returns
- NoError - The function has completed with success.
- APIERR_NOPLAN - No open project.
◆ ACAPI_Database_RebuildWindowValidator()
Sets the element and checksum list for an already added validator with given guid.
- Parameters
-
pValidatorInfo | Contains the guid of a window which is the owner of the validator and the new element and checksum list. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - pValidatorInfo is nullptr
- APIERR_MEMFULL - Not enough memory to complete the operation.
- APIERR_GENERAL - There is no validator registered for this guid.
◆ ACAPI_Database_RedrawCurrentDatabase()
GSErrCode ACAPI_Database_RedrawCurrentDatabase |
( |
| ) |
|
Redraws the current database, even it's associated window is in the background.
- Returns
- NoError - The function has completed with success.
- APIERR_NOPLAN - No open project.
◆ ACAPI_Database_StartClippingSession()
GSErrCode ACAPI_Database_StartClippingSession |
( |
| ) |
|
Sets up clipping session for newly created elements to be clipped.
- Returns
- NoError - The function has completed with success.
- APIERR_NESTING - the clip session is opened for the database
- Example
GSErrCode err;
err = ACAPI_Database (APIDb_StartClippingSessionID
, nullptr, nullptr);
if (err == NoError) {
err = ACAPI_Database (APIDb_DoClipID, &clipRegion, nullptr);
}
err = ACAPI_Database (APIDb_StopClippingSessionID, nullptr, nullptr);
◆ ACAPI_Database_StopClippingSession()
GSErrCode ACAPI_Database_StopClippingSession |
( |
| ) |
|
Stops clipping elements.
- Returns
- NoError - The function has completed with success.
- APIERR_GENERAL - no opened clipping session for the database
◆ ACAPI_Window_AddTextWindowContent()
GSErrCode ACAPI_Window_AddTextWindowContent |
( |
API_WindowInfo * |
windowInfo, |
|
|
const char * |
content, |
|
|
const GS::UniString * |
uniContent = nullptr |
|
) |
| |
Adds new lines to the content of a text window.
- Parameters
-
windowInfo | [in] window identification |
content | [in] the text to append |
uniContent | [in] the Unicode text to append |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - windowPars is nullptr,
- APIERR_REFUSEDPAR - not
APIWind_MyTextID
is referenced,
- APIERR_WINDNOTEXIST - the referenced window does not exist
- Example
GS::UniString buffer;
GSErrCode err;
windowInfo.
typeID = APIWind_MyTextID;
windowInfo.refCon = 1;
buffer = GS::UniString::Printf ("Number of lines: %d\nOK\n", nLine);
err = ACAPI_Database (APIDb_AddTextWindowContentID, &windowInfo, nullptr, &buffer);
◆ ACAPI_Window_CloseWindow()
Closes a window.
- Parameters
-
windowInfo | parameters of the window to be closed (type and reference index) |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - windowPars is nullptr.
- APIERR_REFUSEDCMD - the function is called from notification level.
- APIERR_REFUSEDPAR - not
APIWind_MyTextID
or APIWind_MyDrawID
is requested.
- APIERR_WINDNOTEXIST - a window with the same type and reference index is not opened.
- APIERR_NOPLAN - no open project
- Example
GSErrCode err;
windowInfo.
typeID = APIWind_MyDrawID;
err = ACAPI_Database (APIDb_CloseWindowID, &windowInfo, nullptr);
Int32 index
usually the database/window index (the refCon value in case of custom windows, not used for Section/E...
Definition: APIdefs_Database.h:285
◆ ACAPI_Window_DestroyWindowValidator()
GSErrCode ACAPI_Window_DestroyWindowValidator |
( |
const API_Guid * |
pGuid | ) |
|
Destroys an already registered validator for the given guid.
- Parameters
-
pGuid | The guid of the owner window of the validator. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - pValidatorInfo is nullptr
- APIERR_MEMFULL - Not enough memory to complete the operation.
- APIERR_GENERAL - There is no validator registered for this guid.
◆ ACAPI_Window_GetCurrentWindow()
GSErrCode ACAPI_Window_GetCurrentWindow |
( |
API_WindowInfo * |
windowInfo | ) |
|
Returns the identifier of the current (active) window.
- Parameters
-
windowInfo | [out] The identification parameters of the front window |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - windowInfo is nullptr.
- APIERR_BADWINDOW - the type of the current front window is not known by the API
- Example
GSErrCode err = ACAPI_Database (APIDb_GetCurrentWindowID, &windowInfo, nullptr);
◆ ACAPI_Window_GetDatabaseInfo()
Retrieves information of the given database.
- Parameters
-
databaseInfo | [in/out] parameters of the database |
databaseId | [out] Second old identifier. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - databaseInfo is nullptr
- APIERR_BADDATABASE - the passed database reference is not valid
- Example
GS::Array<API_DatabaseUnId> dbases;
GSErrCode err = ACAPI_Database (APIDb_GetLayoutDatabasesID, nullptr, &dbases);
if (err == NoError) {
for (const auto& dbUnId : dbases) {
err = ACAPI_Database (APIDb_GetDatabaseInfoID
, &dbPars, nullptr);
if (err == NoError) {
char msgStr[1024];
sprintf (msgStr, "Layout database [%d] unId:(%d-%d) title:\"%s\" name:\"%s\" ref:\"%s\"",
}
}
}
GS::uchar_t title[API_UniLongNameLen]
the title of the database (Unicode string), as it is displayed on the window title bar (generally "re...
Definition: APIdefs_Database.h:303
◆ ACAPI_Window_GetOwnWindows()
Returns the ids of the opened windows in an array.
- Parameters
-
windowTypeID | [in] TypeID of the opened windows. |
guid | [out] An array of guids of the opened windows. |
- Returns
- NoError - The function has completed with success.
- APIERR_NOPLAN - There is no open project. The operation cannot be executed without an open project.
- APIERR_BADPARS - Incorrect windowTypeID or guid was specified.
◆ ACAPI_Window_NewWindow()
Opens a new window.
- Parameters
-
newWindowPars | [in] parameters of the window to be created (type and reference index) |
handlerProc | [in] Callback function to handle special (e.g. activate) events. Specify nullptr if you are not interested in these events. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - windowPars is nullptr.
- APIERR_REFUSEDCMD - the function is called from notification level.
- APIERR_REFUSEDPAR - not
APIWind_MyTextID
or APIWind_MyDrawID
is requested.
- APIERR_WINDEXIST - a window with the same type and reference index already opened.
- APIERR_NOPLAN - no open project
- Example
GSErrCode err;
windowPars.
typeID = APIWind_MyDrawID;
windowPars.userRefCon = 1;
GS::snuprintf (windowPars.
wTitle, sizeof (windowPars.
wTitle) / sizeof (GS::uchar_t), L(
"API window: %ld"), userRefCon);
err = ACAPI_Database (APIDb_NewWindowID, &windowPars, nullptr);
Parameters to open a new window.
Definition: APIdefs_Database.h:409
API_WindowTypeID typeID
type of the database; only APIWind_MyTextID and APIWind_MyDrawID are allowed.
Definition: APIdefs_Database.h:415
GS::uchar_t wTitle[API_UniLongNameLen]
The window title (Unicode string).
Definition: APIdefs_Database.h:439
◆ ACAPI_Window_ResetCurrentDatabase()
GSErrCode ACAPI_Window_ResetCurrentDatabase |
( |
| ) |
|
Deletes the database elements of the current window and sets up a new, empty environment.
- Returns
- NoError - The function has completed with success.
- APIERR_BADDATABASE - The current database is not a custom drawing or owned by an other addon,
◆ ACAPI_Window_ResetCurrentWindow()
GSErrCode ACAPI_Window_ResetCurrentWindow |
( |
| ) |
|
Deletes the database elements of the current window and sets up a new, empty environment.
- Returns
- NoError - The function has completed with success.
- APIERR_BADWINDOW - The current database is not a custom drawing or owned by an other addon.