Functions related to the use of various notifications of Archicad. They can be used to automatically execute different tasks when a given trigger is executed in Archicad.
More...
|
| enum | API_NotifyEventID {
APINotify_New = 0x00000001
, APINotify_NewAndReset = 0x00000002
, APINotify_Open = 0x00000004
, APINotify_PreSave = 0x00000008
,
APINotify_Save = 0x00000010
, APINotify_Close = 0x00000020
, APINotify_Quit = 0x00000040
, APINotify_TempSave = 0x00000080
,
APINotify_SendChanges = 0x00008000
, APINotify_ReceiveChanges = 0x00010000
, APINotify_ChangeProjectDB = 0x00040000
, APINotify_ChangeWindow = 0x00080000
,
APINotify_ChangeFloor = 0x00100000
, APINotify_ChangeLibrary = 0x00200000
, APINotify_AllInputFinished = 0x00400000
, APINotify_UnitChanged = 0x00800000
,
APINotify_SideviewCreated = 0x01000000
, APINotify_SideviewRebuilt = 0x02000000
, APINotify_PropertyVisibilityChanged = 0x04000000
, APINotify_ClassificationVisibilityChanged = 0x08000000
,
APINotify_ShowIn3DChanged = 0x10000000
} |
| | Possible values for notifications on project events. More...
|
| |
| enum | API_NotifyViewEventID {
APINotifyView_Inserted = 0x00000001
, APINotifyView_Modified = 0x00000002
, APINotifyView_Deleted = 0x00000004
, APINotifyView_Opened = 0x00000008
,
APINotifyView_Begin = 0x00000010
, APINotifyView_End = 0x00000020
} |
| | Possible values for notifications on Project Navigator events. More...
|
| |
| enum | API_NotifyWindowEventID { APINotifyWindow_Rebuild = 1
, APINotifyWindow_Activate = 2
, APINotifyWindow_Close = 3
} |
| | Describes the cause of the window notification. More...
|
| |
| enum | API_ElementDBEventID {
APINotifyElement_BeginEvents = -1
, APINotifyElement_EndEvents = -2
, APINotifyElement_New = 1
, APINotifyElement_Copy = 2
,
APINotifyElement_Change = 3
, APINotifyElement_Edit = 4
, APINotifyElement_Delete = 5
, APINotifyElement_Undo_Created = 11
,
APINotifyElement_Undo_Modified = 12
, APINotifyElement_Undo_Deleted = 13
, APINotifyElement_Redo_Created = 14
, APINotifyElement_Redo_Modified = 15
,
APINotifyElement_Redo_Deleted = 16
, APINotifyElement_PropertyValueChange = 17
, APINotifyElement_ClassificationChange = 18
} |
| | Describes the cause of the element notification. More...
|
| |
| enum | API_NavigatorMapID {
API_UndefinedMap = 0
, API_ProjectMap = 1
, API_PublicViewMap = 2
, API_MyViewMap = 3
,
API_LayoutMap = 4
, API_PublisherSets = 5
} |
| | Enumeration of Project Navigator maps. More...
|
| |
|
| NotificationBubbleManager | ACAPI::UI::Notification::CreateNotificationBubbleManager () |
| | A function to create a notification bubble manager, which lets you create notification bubbles from API.
|
| |
| GSErrCode | ACAPI_Element_AttachObserver (const API_Guid &elemGuid, GSFlags notifyFlags=0) |
| | Attaches an observer to the given element.
|
| |
| GSErrCode | ACAPI_Element_DetachObserver (const API_Guid &elemGuid) |
| | Detaches the observer from the given element.
|
| |
| GSErrCode | ACAPI_Notification_GetObservedElements (GS::Array< API_Elem_Head > *elemHeads) |
| | Returns the elements observed by the add-on.
|
| |
| GSErrCode | ACAPI_ProjectOperation_CatchProjectEvent (GSFlags eventTypes, APIProjectEventHandlerProc *handlerProc) |
| | Register or unregister your add-on to be notified of application and project events.
|
| |
| GSErrCode | ACAPI_Notification_CatchViewEvent (GSFlags eventTypes, API_NavigatorMapID mapId, APIViewEventHandlerProc *handlerProc) |
| | Register or unregister your add-on to be notified of Project Navigator changes.
|
| |
| GSErrCode | ACAPI_Notification_CatchToolChange (APIToolChangeHandlerProc *handlerProc) |
| | Turns the monitoring of toolbox item changes on/off.
|
| |
| GSErrCode | ACAPI_Notification_CatchSelectionChange (APISelectionChangeHandlerProc *handlerProc) |
| | Turns the monitoring of selection changes on/off.
|
| |
| GSErrCode | ACAPI_Element_CatchChangeDefaults (const API_ToolBoxItem *elemType, APIDefaultsChangeHandlerProc *handlerProc) |
| | Register or unregister your add-on to be notified if the default settings of a given element type is modified.
|
| |
| GSErrCode | ACAPI_Element_CatchNewElement (const API_ToolBoxItem *elemType, APIElementEventHandlerProc *handlerProc) |
| | Register or unregister your add-on to be notified if the given type of element is created.
|
| |
| GSErrCode | ACAPI_Notification_CatchAttributeReplacement (APIAttributeReplacementHandlerProc *handlerProc) |
| | Register or unregister your add-on to be notified if some attributes are deleted and replaced by other attributes.
|
| |
| GSErrCode | ACAPI_Element_InstallElementObserver (APIElementEventHandlerProc *handlerProc) |
| | Installs an element observer function which receives notifications on elements' changes.
|
| |
| GSErrCode | ACAPI_Notification_GetTranParams (API_ActTranPars *actTranPars) |
| | Returns the transformation parameters of the actual edit operation.
|
| |
| GSErrCode | ACAPI_Notification_GetParentElement (API_Element *element, API_ElementMemo *memo, UInt64 mask, API_ElementUserData *userData) |
| | Returns the parent of the actual element your addon received notification for.
|
| |
| GSErrCode | ACAPI_Notification_CatchElementReservationChange (APIReservationChangeHandlerProc *handlerProc, const GS::HashSet< API_Guid > *filterElementsInterestedOnly=nullptr) |
| | Sets notification handler for element reservation changes.
|
| |
| GSErrCode | ACAPI_Notification_CatchLockableReservationChange (APILockChangeHandlerProc *handlerProc, const GS::HashSet< API_Guid > *filterLockablesInterestedOnly=nullptr) |
| | Sets notification handler for reservation changes of lockable objects.
|
| |
| GSErrCode | ACAPI_Licensing_CatchLicenseBorrowStatusChange (APILicenseBorrowStatusChangeHandlerProc *handlerProc) |
| | Catches notifications on license borrowing status changes.
|
| |
| GSErrCode | ACAPI_Notification_ClassificationVisibilityChanged () |
| | Sends out an APINotify_ClassificationVisibilityChanged project event notification to the other add-ons to state that at least one classification's visibility has changed.
|
| |
| GSErrCode | ACAPI_Notification_PropertyVisibilityChanged () |
| | Sends out an APINotify_PropertyVisibilityChanged project event notification to the other add-ons to state that at least one property's visibility has changed.
|
| |
| GSErrCode | ACAPI_Notification_RegisterEventHandler (GS::Owner< API_IEventHandler > eventHandler, API_Guid &id) |
| | Register an event handler in your add-on.
|
| |
| GSErrCode | ACAPI_Notification_UnregisterEventHandler (const API_Guid &id) |
| | Unregister an event handler from your add-on.
|
| |
Functions related to the use of various notifications of Archicad. They can be used to automatically execute different tasks when a given trigger is executed in Archicad.
Notification Manager
The Notification Manager lets your add-on be integrated more into the Archicad environment.
It is very important to understand the underlying ideas and technologies in order to be able to use the services in the right way.
It is very easy to block Archicad using the Notification Manager in a wrong way; so be very careful!
The key point that you have to keep in mind is that notifications are coming in the background, without any user interaction. Plan your system concentrating on this issue; do not perform time consuming operations, and also do not make changes that have global effects, although the Notification Manager tries to detect and refuse such operations, of course.
What kind of events can an add-on receive notification of?
An add-on can catch events occured to the actual project such as opening, saving, closing the plan file; can be notified of teamwork events, and several changes in the program environment. Furthermore the add-ons can get notification of events happened to the elements of the project database such as creation, modification and deletion. Also there can be notified of undoing and redoing element database changes.
Functions
All of the notification manager functions begin with the ACAPI_Notify_ prefix. This function family gives support to register your add-on to receive notifications when the requested event(s) occured. Once a notification is posted you get the control and you are allowed to call almost all of the API functions to handle the event.
In order to be notified of certain events you have to make a registration with the following functions:
If you would like to receive notifications of certain events from the application start up on, you can claim your add-on to be pre-loaded by returning APIAddon_Preload from the CheckEnvironment function instead of APIAddon_Normal. This ensures that the Initialize function of your add-on will be called right after start up, and there you can register your callback functions. While you have any callback function installed into the API registration, your add-on keeps loaded in the memory, thus the function pointers remain valid.
The following functions are supported to provide access to additional information while handling a notification posted to you:
Element related notifications
Monitoring elements
In order to be notified of events that happen to a specified element in the database you have to attach an observer to the element with the ACAPI_Element_AttachObserver function. This information then will be saved into the project file, so next time you use that plan the notification system will notify your add-on about changes of elements you have marked for monitoring before.
You can catch element creation events if your add-on installs an APIElementEventHandlerProc element event handler function with ACAPI_Element_CatchNewElement. You may specify a certain type of elements if you are interested in these new elements only. You can use the same callback function for more element types at the same time. If you want to follow up the modifications of the newly created element, you can attach an observer to it at once right from the new element callback.
How does it work?
The element related notification system is based on the undo list of Archicad, that is it processes the undo entries created by the last operation.
Assume that there are three add-ons monitoring some set of elements in the current project. Add-on "A" has linked objects to walls, and watches if something happens to those walls to keep the objects aligned to the walls. Add-on "B" has a sort of autotext functionality, it is to be notified of word element creation. Finally Add-on "C" controls the length of walls, it may delete some walls and replace them with a note.
The following figure shows what happens in this configuration if the user stretches two walls on the floor plan:
After editing the walls the notification mechanism searches the current undo entry for elements that the first add-on is supposed to do something with. Whenever it finds an element reference that the add-on has attached observer to, or the element was created and the add-on has required notification of new elements of that type, the notification manager calls the appropriate callback function (APIElementEventHandlerProc) of the add-on.
After reaching last entry the original operation created in the undo step, the whole searching method restarts from the beginning for the next add-on to be notified.
On being notified an add-on probably adds new entries to the current undo step. However the add-on will not be notified of element changes made by itself.
◆ APIAttributeReplacementHandlerProc
User supplied callback procedure for handling attribute replacements.
- Parameters
-
| table | [in] List of attributes replaced. The hash key in the hash table is the type of attribute (material, profile etc.), the paired value is another hash table, which holds the old (deleted) attribute indices as keys, and the replacement attribute indices as values. |
- Returns
- NoError - The function has completed with success.
◆ APIDefaultsChangeHandlerProc
| typedef GSErrCode APIDefaultsChangeHandlerProc(const API_ToolBoxItem *defElemType) |
Callback procedure to receive notifications on changes in element defaults.
- Parameters
-
| defElemType | [in] The element type the notification is coming for. |
- Returns
- NoError - The function has completed with success.
◆ APIElementEventHandlerProc
User supplied callback function for handling changes in elements.
- Parameters
-
| elemType | [in] This structure contains the various parameters identifying the element the notification is for. |
- Returns
- NoError - The function has completed with success.
- Example
#define ELEMSTR_LEN 256
bool GetElementTypeString (
const API_ElemType& type,
char *elemStr)
{
GS::UniString ustr;
if (err == NoError) {
CHTruncate (ustr.ToCStr (), elemStr, ELEMSTR_LEN - 1);
return true;
}
return false;
}
{
GSErrCode err = NoError;
char msgStr[256];
char elemStr[32];
if (GetElementTypeString (elemType->
elemHead.
type, elemStr)) {
sprintf (msgStr, "### API Notify Test: %s #%s created as a copy of #%s",
else
sprintf (msgStr, "### API Notify Test: %s #%s created", elemStr,
} else
sprintf (msgStr, "### API Notify Test: Unknown element type created");
break;
default:
break;
}
if (err == NoError)
return NoError;
}
{
}
◆ APILicenseBorrowStatusChangeHandlerProc
User supplied callback procedure for handling license borrowing status changes.
- Parameters
-
| licenseBorrowStatus | [out] The status of license borrowing, can be API_LicenseBorrowed or API_LicenseReturned. |
- Returns
- NoError - The function has completed with success.
◆ APILockChangeHandlerProc
| typedef GSErrCode APILockChangeHandlerProc(const API_Guid &objectId, short ownerId) |
User supplied callback procedure for handling reservation changes of lockable objects.
- Parameters
-
| objectId | [in] Identifies the lockable object set that has been reserved or released. The available identifiers are listed at the description of lockable object sets. |
| ownerId | [in] The identifier of the locker team member who obtained the reservation, or 0 if the lockable object got released. |
- Returns
- NoError - The function has completed with success.
- Example
GSErrCode LockableReservationChangeHandler (
const API_Guid& objectId,
short ownerId)
{
GS::UniString reportString;
reportString.Append ("Fill Types");
else
reportString.Append ("Layer Settings");
if (ownerId > 0)
reportString.Append (" got reserved");
else
reportString.Append (" got released");
return NoError;
}
void CatchReservationChangesOfFillTypesAndLayerSettings (bool enableNotifications)
{
if (enableNotifications) {
GS::HashSet<API_Guid> filterLockablesInterestedOnly;
} else {
}
}
◆ APIProjectEventHandlerProc
Callback function to receive notifications on changes of the project.
- Parameters
-
| notifID | [in] The type of the project event the notification is for. |
| param | [in] This parameter is valid only if the notifID is APINotify_ChangeLibrary. If an individual library part has changed in the library (e.g. it was added to the library), then this parameter contains the index of that library part. This parameter is also valid if notifID is APINotify_ChangeProjectDB, and contains a code for the cause of the event. |
| param | Event cause |
| 0 | Other |
| 1 | Floor(s) edited |
| 2 | Merge |
- Returns
- NoError - The function has completed with success.
◆ APIReservationChangeHandlerProc
| typedef GSErrCode APIReservationChangeHandlerProc(const GS::HashTable< API_Guid, short > &reserved, const GS::HashSet< API_Guid > &released, const GS::HashSet< API_Guid > &deleted) |
User supplied callback procedure for handling element reservation changes.
- Parameters
-
| reserved | [in] List of elements recently reserved. The hash key in the hash table is the element guid, the paired value is the Teamwork owner identifier of the member who reserved the element. |
| released | [in] List of elements recently released. |
| deleted | [in] List of elements deleted during the recent Teamwork operations. Element deletions are reported when the member who deleted the elements sends the changes to the BIM Server. |
- Returns
- NoError - The function has completed with success.
- Example
GSErrCode ElementReservationChangeHandler (const GS::HashTable<API_Guid, short>& reserved,
const GS::HashSet<API_Guid>& ,
const GS::HashSet<API_Guid>& )
{
GS::HashTable<API_ElemTypeID,Int32> reservedStat;
for (GS::HashTable<API_Guid, short>::ConstPairIterator it = reserved.EnumeratePairs (); it != nullptr; ++it) {
++(reservedStat.Retrieve (elemHead.
type.
typeID, 0));
}
if (!reservedStat.IsEmpty ()) {
GS::UniString reportString ("= Recently reserved elements: ");
for (GS::HashTable<API_ElemTypeID,Int32>::PairIterator it = reservedStat.EnumeratePairs (); it != nullptr; ++it) {
GS::UniString elemTypeName;
GS::UniString elemCountStr = GS::UniString::Printf (" %T:%d", elemTypeName.ToPrintf (), it->value);
reportString.Append (elemCountStr);
}
}
return NoError;
}
void CatchElementReservationChanges (bool enableNotifications)
{
if (enableNotifications)
else
}
◆ APISelectionChangeHandlerProc
| typedef GSErrCode APISelectionChangeHandlerProc(const API_Neig *selElemNeig) |
User supplied callback procedure for handling selection changes.
- Parameters
-
| selElemNeig | [in] This structure identifies the last selected element. |
- Returns
- NoError - The function has completed with success.
◆ APIToolChangeHandlerProc
| typedef GSErrCode APIToolChangeHandlerProc(const API_ToolBoxItem *newToolMode) |
Callback function to handle changes in the toolbox.
- Parameters
-
| newToolMode | [in] The toolbox mode the user switched to. |
- Returns
- NoError - The function has completed with success.
◆ APIViewEventHandlerProc
User supplied callback function for handling changes of Project Navigator items.
- Parameters
-
| viewEvent | [in] This structure identifies the Project Navigator item and the event the add-on is called for. |
- Returns
- NoError - The function has completed with success.
◆ API_ElementDBEventID
Describes the cause of the element notification.
| Enumerator |
|---|
| APINotifyElement_BeginEvents | Indicates the start of element notifications.
|
| APINotifyElement_EndEvents | End of element notifications (no more notifications are expected in this task).
|
| APINotifyElement_New | A new element was created.
|
| APINotifyElement_Copy | The element was copied; the notifications are coming for the copy of the original element.
|
| APINotifyElement_Change | The parameters of the element were changed.
|
| APINotifyElement_Edit | The element was edited. The parameters of the editing transformation can be retrieved with ACAPI_Notification_GetTranParams.
|
| APINotifyElement_Delete | The element was deleted.
|
| APINotifyElement_Undo_Created | The last creating operation performed on the element has been undone.
|
| APINotifyElement_Undo_Modified | The last modifying operation performed on the element has been undone.
|
| APINotifyElement_Undo_Deleted | The last deleting operation performed on the element has been undone.
|
| APINotifyElement_Redo_Created | The last undone creating operation on the element has been redone.
|
| APINotifyElement_Redo_Modified | The last undone modifying operation on the element has been redone.
|
| APINotifyElement_Redo_Deleted | The last undone deleting operation on the element has been redone.
|
| APINotifyElement_PropertyValueChange | A property value attached to the element has been changed.
|
| APINotifyElement_ClassificationChange | An element's classification has changed.
|
◆ API_NavigatorMapID
Enumeration of Project Navigator maps.
| Enumerator |
|---|
| API_UndefinedMap | Undefined Project Navigator map.
|
| API_ProjectMap | Project map.
|
| API_PublicViewMap | Public View map.
|
| API_MyViewMap | Your own view map (only in Teamwork mode).
|
| API_LayoutMap | Layout map.
|
| API_PublisherSets | Publisher Sets.
|
◆ API_NotifyEventID
Possible values for notifications on project events.
- Since
- Archicad 26
| Enumerator |
|---|
| APINotify_New | The user chose New from the File menu.
|
| APINotify_NewAndReset | The user chose New & Reset from the File menu.
|
| APINotify_Open | The user opened an existing project.
|
| APINotify_PreSave | The user has chosen Save from the File menu; this notification is coming before the actual save is performed, so that you could save some data into the project file. Please try to avoid using this method if not necessary, because it can significantly slow down the file saving process. Rather store the additional data into the project when they actually change.
|
| APINotify_Save | The user has chosen Save from the File menu; the project has already been saved.
|
| APINotify_Close | The user closed the current project.
|
| APINotify_Quit | The user chose Quit from the File menu.
|
| APINotify_TempSave | The project is about to be autosaved.
|
| APINotify_SendChanges | The user is about to send changes into the Teamwork project.
|
| APINotify_ReceiveChanges | The user has received the changes from the Teamwork project.
|
| APINotify_ChangeProjectDB | The project database changed.
|
| APINotify_ChangeWindow | The current window changed.
|
| APINotify_ChangeFloor | The user switched to an other floor.
|
| APINotify_ChangeLibrary | The loaded libraries were changed.
|
| APINotify_AllInputFinished | Sent when an input process (open, merge, etc.) is finished.
|
| APINotify_UnitChanged | Notifies that the working units or calculation units have changed on Preferences dialogs.
|
| APINotify_SideviewCreated | The section/elevation/interior elevation was generated. The first time its window was opened.
|
| APINotify_SideviewRebuilt | The section/elevation/interior elevation was rebuilt.
|
| APINotify_PropertyVisibilityChanged | Notifies that Property visibility has changed.
|
| APINotify_ClassificationVisibilityChanged | Notifies that Classification visibility has changed.
|
| APINotify_ShowIn3DChanged | This notification is sent when the user has chosen Show Selection in 3D / Show All in 3D / Show stored selection in 3D.
|
◆ API_NotifyViewEventID
Possible values for notifications on Project Navigator events.
| Enumerator |
|---|
| APINotifyView_Inserted | A new Project Navigator item was inserted.
|
| APINotifyView_Modified | A Project Navigator item was modified.
|
| APINotifyView_Deleted | A Project Navigator item was deleted.
|
| APINotifyView_Opened | A Project Navigator item was opened.
|
| APINotifyView_Begin | The begin notification.
|
| APINotifyView_End | The end notification.
|
◆ API_NotifyWindowEventID
Describes the cause of the window notification.
| Enumerator |
|---|
| APINotifyWindow_Rebuild | The user chose Rebuild from the menu.
|
| APINotifyWindow_Activate | Your window was activated.
|
| APINotifyWindow_Close | The user closed your window.
|
◆ ACAPI_Element_AttachObserver()
| GSErrCode ACAPI_Element_AttachObserver |
( |
const API_Guid & | elemGuid, |
|
|
GSFlags | notifyFlags = 0 ) |
Attaches an observer to the given element.
- Parameters
-
| elemGuid | [in] Identifies the element to attach the observer to. |
| notifyFlags | [in] Defines the behavior of the attached observer in certain database operations. |
- Returns
- NoError - The function has completed successfully.
- APIERR_BADID - The referenced element cannot be found in the database.
◆ ACAPI_Element_CatchChangeDefaults()
Register or unregister your add-on to be notified if the default settings of a given element type is modified.
- Parameters
-
| elemType | [in] Specifies the type of element for which your add-on should be notified. In order to receive notification on changing the default settings of any type of element, you simply pass nullptr as this parameter. |
| handlerProc | [in] The callback procedure to call when notifications are sent out on changing the default settings of this element type. Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The required operation finished successfully.
- APIERR_BADID - The elemType parameter contains an invalid type.
- Example
#define ELEMSTR_LEN 256
bool GetElementTypeString (
const API_ElemType& type,
char *elemStr)
{
GS::UniString ustr;
if (err == NoError) {
CHTruncate (ustr.ToCStr (), elemStr, ELEMSTR_LEN - 1);
return true;
}
return false;
}
{
char msgStr[256];
char elemStr[32];
if (GetElementTypeString (defElemType->
type, elemStr))
sprintf (msgStr, "%s element type defaults changed", elemStr);
else
sprintf (msgStr, "Unknown element type defaults changed");
return NoError;
}
{
}
◆ ACAPI_Element_CatchNewElement()
Register or unregister your add-on to be notified if the given type of element is created.
- Parameters
-
| elemType | [in] Specifies the type of element for which your add-on should be notified. In order to receive notification on the creation of any type of elements, you simply pass nullptr as this parameter. |
| handlerProc | [in] The callback procedure to call when notifications are sent out on creating this type of element. Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The requested operation finished successfully.
- APIERR_BADID - The elemType parameter contains an invalid type.
- Example
#define ELEMSTR_LEN 256
bool GetElementTypeString (
const API_ElemType& type,
char *elemStr)
{
GS::UniString ustr;
if (err == NoError) {
CHTruncate (ustr.ToCStr (), elemStr, ELEMSTR_LEN - 1);
return true;
}
return false;
}
{
GSErrCode err = NoError;
char msgStr[256];
char elemStr[32];
if (GetElementTypeString (elemType->
elemHead.
type, elemStr)) {
sprintf (msgStr, "### API Notify Test: %s #%s created as a copy of #%s",
else
sprintf (msgStr, "### API Notify Test: %s #%s created", elemStr,
} else
sprintf (msgStr, "### API Notify Test: Unknown element type created");
break;
default:
break;
}
if (err == NoError)
return NoError;
}
{
}
◆ ACAPI_Element_DetachObserver()
| GSErrCode ACAPI_Element_DetachObserver |
( |
const API_Guid & | elemGuid | ) |
|
Detaches the observer from the given element.
- Parameters
-
| elemGuid | [in] Identifies the element to detach the observer from. |
- Returns
- NoError - The function has completed successfully.
- APIERR_BADID - The referenced element cannot be found in the database.
◆ ACAPI_Element_InstallElementObserver()
Installs an element observer function which receives notifications on elements' changes.
- Parameters
-
| handlerProc | [in] The callback procedure to call when notifications are sent out on changes of elements. Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The function completed successfully.
- Example
#define ELEMSTR_LEN 256
bool GetElementTypeString (
const API_ElemType& type,
char *elemStr)
{
GS::UniString ustr;
if (err == NoError) {
CHTruncate (ustr.ToCStr (), elemStr, ELEMSTR_LEN - 1);
return true;
}
return false;
}
{
GSErrCode err = NoError;
char msgStr[256];
char elemStr[32];
sprintf (msgStr, "### Element_Manager: %s #%s copied from #%s",
}
break;
default:
break;
}
if (err == NoError)
return err;
}
{
}
◆ ACAPI_Licensing_CatchLicenseBorrowStatusChange()
Catches notifications on license borrowing status changes.
- Parameters
-
| handlerProc | [in] The callback function which receives the notifications. |
- Returns
- NoError - The function has completed successfully.
◆ ACAPI_Notification_CatchAttributeReplacement()
Register or unregister your add-on to be notified if some attributes are deleted and replaced by other attributes.
- Since
- Archicad 25
- Parameters
-
| handlerProc | [in] The callback procedure to call when notifications are sent out on replacement of attributes. Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The required operation finished successfully.
- Example
{
char msgStr[256];
sprintf (msgStr, "Changed Material: old index = %d, new index = %d", entry.key.ToInt32_Deprecated (), entry.value.ToInt32_Deprecated ());
}
}
return NoError;
}
{
}
◆ ACAPI_Notification_CatchElementReservationChange()
Sets notification handler for element reservation changes.
- Parameters
-
| handlerProc | [in] Notification handler function to be called on the specified event. Pass nullptr to unsubscribe from this notification. |
| filterElementsInterestedOnly | [in] List of element guids; optional parameter for controlling the range of elements of interest. If passed, the reservation change notifications will be sent for only these elements, otherwise every element reservation changes will be reported. |
- Returns
- NoError - The function completed successfully.
- Example
GSErrCode ElementReservationChangeHandler (const GS::HashTable<API_Guid, short>& reserved,
const GS::HashSet<API_Guid>& ,
const GS::HashSet<API_Guid>& )
{
GS::HashTable<API_ElemTypeID,Int32> reservedStat;
for (GS::HashTable<API_Guid, short>::ConstPairIterator it = reserved.EnumeratePairs (); it != nullptr; ++it) {
++(reservedStat.Retrieve (elemHead.
type.
typeID, 0));
}
if (!reservedStat.IsEmpty ()) {
GS::UniString reportString ("= Recently reserved elements: ");
for (GS::HashTable<API_ElemTypeID,Int32>::PairIterator it = reservedStat.EnumeratePairs (); it != nullptr; ++it) {
GS::UniString elemTypeName;
GS::UniString elemCountStr = GS::UniString::Printf (" %T:%d", elemTypeName.ToPrintf (), it->value);
reportString.Append (elemCountStr);
}
}
return NoError;
}
void CatchElementReservationChanges (bool enableNotifications)
{
if (enableNotifications)
else
}
See also the Teamwork Control and Notification Manager example projects of the API Development Kit.
◆ ACAPI_Notification_CatchLockableReservationChange()
| GSErrCode ACAPI_Notification_CatchLockableReservationChange |
( |
APILockChangeHandlerProc * | handlerProc, |
|
|
const GS::HashSet< API_Guid > * | filterLockablesInterestedOnly = nullptr ) |
Sets notification handler for reservation changes of lockable objects.
- Parameters
-
| handlerProc | [in] Notification handler function to be called on the specified event. Pass nullptr to unsubscribe from this notification. |
| filterLockablesInterestedOnly | [in] List of guids of lockable objects; optional parameter for controlling the range of objects of interest. If passed, the lock change notifications will be sent for only these objects, otherwise every lock changes will be reported. |
- Returns
- NoError - The function completed successfully.
- Example
GSErrCode LockableReservationChangeHandler (
const API_Guid& objectId,
short ownerId)
{
GS::UniString reportString;
reportString.Append ("Fill Types");
else
reportString.Append ("Layer Settings");
if (ownerId > 0)
reportString.Append (" got reserved");
else
reportString.Append (" got released");
return NoError;
}
void CatchReservationChangesOfFillTypesAndLayerSettings (bool enableNotifications)
{
if (enableNotifications) {
GS::HashSet<API_Guid> filterLockablesInterestedOnly;
} else {
}
}
See also the Teamwork Control and Notification Manager example projects of the API Development Kit.
◆ ACAPI_Notification_CatchSelectionChange()
Turns the monitoring of selection changes on/off.
- Parameters
-
| handlerProc | [in] The callback procedure to call when notifications are sent out on changes in the selection. Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The function completed successfully.
- Example
static GSErrCode SelectionChangeHandler (
const API_Neig *selElemNeig)
{
char msgStr[256];
sprintf (msgStr, "Last selected element: NeigID %d; index: %d, inIndex: %d",
} else
return NoError;
}
{
}
◆ ACAPI_Notification_CatchToolChange()
Turns the monitoring of toolbox item changes on/off.
- Parameters
-
| handlerProc | [in] The callback procedure to call when notifications are sent out on changes in the selection. Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The function completed successfully.
- Example
#define ELEMSTR_LEN 256
bool GetElementTypeString (
const API_ElemType& type,
char *elemStr)
{
GS::UniString ustr;
if (err == NoError) {
CHTruncate (ustr.ToCStr (), elemStr, ELEMSTR_LEN - 1);
return true;
}
return false;
}
{
char msgStr[256];
char elemStr[32];
CHCopyC ("Arrow or Marquee", elemStr);
else if (!GetElementTypeString (newToolMode->
type.
typeID, elemStr))
CHCopyC ("Unknown", elemStr);
sprintf (msgStr, "%s toolbox mode selected", elemStr);
return NoError;
}
{
}
◆ ACAPI_Notification_CatchViewEvent()
Register or unregister your add-on to be notified of Project Navigator changes.
- Parameters
-
| eventTypes | [in] A combination of different API_NotifyViewEventID values, specifying the types of project navigator events you are interested in. |
| mapId | [in] Specifies the project navigator map you are interested in. |
| handlerProc | [in] The callback procedure to call when notifications are sent out... Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The requested operation finished successfully.
- APIERR_BADPARS - The eventTypes parameter is invalid.
- Example
-
◆ ACAPI_Notification_ClassificationVisibilityChanged()
| GSErrCode ACAPI_Notification_ClassificationVisibilityChanged |
( |
| ) |
|
Sends out an APINotify_ClassificationVisibilityChanged project event notification to the other add-ons to state that at least one classification's visibility has changed.
- Returns
- NoError - The function completed successfully.
◆ ACAPI_Notification_GetObservedElements()
| GSErrCode ACAPI_Notification_GetObservedElements |
( |
GS::Array< API_Elem_Head > * | elemHeads | ) |
|
Returns the elements observed by the add-on.
- Parameters
-
| elemHeads | [out] The headers of the observed elements. |
- Returns
- NoError - The function has completed successfully.
◆ ACAPI_Notification_GetParentElement()
Returns the parent of the actual element your addon received notification for.
- Parameters
-
| element | [out] The parent element to be retrieved. |
| memo | [out] Additional data of the parent element. |
| mask | [in] Mask for specifying the relevant memo handles to be retrieved. |
| userData | [out] Userdata of the parent element. |
- Returns
- NoError - The function was executed without error.
- APIERR_REFUSEDCMD - There was no parent element during the action.
- Example
#define ELEMSTR_LEN 256
bool GetElementTypeString (
const API_ElemType& type,
char *elemStr)
{
GS::UniString ustr;
if (err == NoError) {
CHTruncate (ustr.ToCStr (), elemStr, ELEMSTR_LEN - 1);
return true;
}
return false;
}
{
GSErrCode err = NoError;
char msgStr[256];
char elemStr[32];
if (GetElementTypeString (elemType->
elemHead.
type, elemStr)) {
sprintf (msgStr, "### API Notify Test: %s #%s created as a copy of #%s",
else
sprintf (msgStr, "### API Notify Test: %s #%s created", elemStr,
} else
sprintf (msgStr, "### API Notify Test: Unknown element type created");
break;
default:
break;
}
if (err == NoError)
return NoError;
}
{
}
◆ ACAPI_Notification_GetTranParams()
| GSErrCode ACAPI_Notification_GetTranParams |
( |
API_ActTranPars * | actTranPars | ) |
|
Returns the transformation parameters of the actual edit operation.
- Parameters
-
| actTranPars | [out] The transformation parameters to be returned. |
- Returns
- NoError - The function has been executed without error.
- APIERR_BADPARS - The actTranPars parameter is nullptr.
- Example
GS::Array<API_Neig> neig;
Int32 elemIndex = 1;
GSErrCode err;
switch (eventID) {
editPars.begC.x = 0.0;
editPars.endC.y = 0.0;
editPars.endC.z = 0.0;
editPars.endC.x = actTranPars.
theDisp.
x;
editPars.endC.y = actTranPars.
theDisp.
y;
break;
editPars.begC.
x = editPars.origC.x + 1.0;
editPars.begC.y = editPars.origC.y;
editPars.begC.z = 0.0;
editPars.endC.x = editPars.origC.x + actTranPars.
theCosA;
editPars.endC.y = editPars.origC.y + actTranPars.
theSinA;
editPars.endC.z = 0.0;
break;
editPars.begC.z = 0.0;
editPars.endC.z = 0.0;
break;
editPars.endC.x = actTranPars.
theDisp.
x;
editPars.endC.y = actTranPars.
theDisp.
y;
editPars.endC.z = 0.0;
break;
}
editPars.withDelete = true;
neig[0].elemPartIndex = elemIndex;
neig[0].inIndex = 1;
if (err != NoError)
WriteReport_Err ("Error in ACAPI_Element_Edit", err);
break;
}
◆ ACAPI_Notification_PropertyVisibilityChanged()
| GSErrCode ACAPI_Notification_PropertyVisibilityChanged |
( |
| ) |
|
Sends out an APINotify_PropertyVisibilityChanged project event notification to the other add-ons to state that at least one property's visibility has changed.
- Returns
- NoError - The function completed successfully.
◆ ACAPI_Notification_RegisterEventHandler()
Register an event handler in your add-on.
- Since
- Archicad 26
- Parameters
-
| eventHandler | [in] The event handler to be registered. |
| id | [out] The identifier of the successfully registered event handler. |
- Returns
- NoError - The requested operation finished successfully.
- APIERR_BADPARS - The requested operation failed due to a nullptr in-parameter.
- Example
public:
virtual ~ClassificationSystemEventHandler ();
virtual void OnCreated (const GS::HashSet<API_Guid>& ids) const override
{
for (const auto& id : ids) {
}
}
};
ClassificationSystemEventHandler::~ClassificationSystemEventHandler () {}
{
}
◆ ACAPI_Notification_UnregisterEventHandler()
| GSErrCode ACAPI_Notification_UnregisterEventHandler |
( |
const API_Guid & | id | ) |
|
Unregister an event handler from your add-on.
- Since
- Archicad 26
- Parameters
-
| id | [in] The identifier of a previously registered event handler. |
- Returns
- NoError - The requested operation finished successfully.
- APIERR_BADPARS - The requested operation failed due to an invalid id in-parameter.
- Example
-
◆ ACAPI_ProjectOperation_CatchProjectEvent()
Register or unregister your add-on to be notified of application and project events.
- Parameters
-
| eventTypes | [in] A combination of different API_NotifyEventID values, specifying the types of project events you are interested in. |
| handlerProc | [in] The callback procedure to call when notifications are sent out on different project events. Specifying nullptr here means you don't need the notifications any more. |
- Returns
- NoError - The requested operation finished successfully.
- Example
{
char msgStr[256];
switch (notifID) {
}
return NoError;
}
{
return err;
}
◆ CreateNotificationBubbleManager()
A function to create a notification bubble manager, which lets you create notification bubbles from API.
- Returns
- The notification bubble manager.