Archicad 28 C++ API
|
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...
Classes | |
class | ACAPI::API_IKeynoteEventNotifier |
Defining an interface for a class that will be used to notify keynote event handlers. More... | |
class | ACAPI::API_IKeynoteItemEventHandler |
The base class you need to inherit from in case you want to handle keynote item events. More... | |
class | ACAPI::API_IKeynoteFolderEventHandler |
The base class you need to inherit from in case you want to handle keynote folder events. More... | |
struct | API_NotifyViewEventType |
Describes the Project Navigator item the notification is coming for, and the type of the notification. More... | |
struct | API_NotifyElementType |
Describes the element the notification is coming for, and the type of the notification. More... | |
class | API_IEventNotifier |
Defining an interface for a class that will be used to notify all event handlers. More... | |
class | API_IACEventNotifier |
Defining an interface for a class that will be used to notify event handlers. More... | |
class | API_IEventHandler |
Defining an interface for all event handlers. More... | |
class | API_IObjectEventHandler |
Defining an interface for Object event handlers. More... | |
class | API_IDialogEventHandler |
Defining an interface for Dialog event handlers. More... | |
class | API_IAttributeEventHandler |
Defining an interface for Attribute event handlers. More... | |
class | API_IAttributeFolderEventHandler |
Defining an interface for Attribute Folder event handlers. More... | |
class | API_IClassificationSystemEventHandler |
The base class you need to inherit from in case you want to handle API_ClassificationSystem events. More... | |
class | API_IClassificationItemEventHandler |
The base class you need to inherit from in case you want to handle API_ClassificationItem events. More... | |
class | API_IPropertyGroupEventHandler |
The base class you need to inherit from in case you want to handle API_PropertyGroup events. More... | |
class | API_IPropertyDefinitionEventHandler |
The base class you need to inherit from in case you want to handle API_PropertyDefinition events. More... | |
class | API_IGraphisoftIDEventHandler |
class | API_IEnableAllInfoDialogEventHandler |
class | API_IMarqueeEventHandler |
class | API_IWindowEventHandler |
The base class you need to inherit from in case you want to handle window change events. More... | |
struct | API_ActTranPars |
Structure for retrieving the transformation data of the actual editing operation. More... | |
Typedefs | |
typedef GSErrCode | APIProjectEventHandlerProc(API_NotifyEventID notifID, Int32 param) |
Callback function to receive notifications on changes of the project. | |
typedef GSErrCode | APIViewEventHandlerProc(const API_NotifyViewEventType *viewEvent) |
User supplied callback function for handling changes of Project Navigator items. | |
typedef GSErrCode | APIDefaultsChangeHandlerProc(const API_ToolBoxItem *defElemType) |
Callback procedure to receive notifications on changes in element defaults. | |
typedef GSErrCode | APIToolChangeHandlerProc(const API_ToolBoxItem *newToolMode) |
Callback function to handle changes in the toolbox. | |
typedef GSErrCode | APISelectionChangeHandlerProc(const API_Neig *selElemNeig) |
User supplied callback procedure for handling selection changes. | |
typedef GSErrCode | APIAttributeReplacementHandlerProc(const API_AttributeReplaceIndexTable &table) |
User supplied callback procedure for handling attribute replacements. | |
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. | |
typedef GSErrCode | APILockChangeHandlerProc(const API_Guid &objectId, short ownerId) |
User supplied callback procedure for handling reservation changes of lockable objects. | |
typedef GSErrCode | APILicenseBorrowStatusChangeHandlerProc(API_LicenseBorrowStatusTypeID licenseBorrowStatus) |
User supplied callback procedure for handling license borrowing status changes. | |
typedef GSErrCode | APIElementEventHandlerProc(const API_NotifyElementType *elemType) |
User supplied callback function for handling changes in elements. | |
Enumerations | |
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_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... | |
Functions | |
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.
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.
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.
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:
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.
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.
typedef GSErrCode APIAttributeReplacementHandlerProc(const API_AttributeReplaceIndexTable &table) |
User supplied callback procedure for handling attribute replacements.
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. |
typedef GSErrCode APIDefaultsChangeHandlerProc(const API_ToolBoxItem *defElemType) |
Callback procedure to receive notifications on changes in element defaults.
defElemType | [in] The element type the notification is coming for. |
typedef GSErrCode APIElementEventHandlerProc(const API_NotifyElementType *elemType) |
User supplied callback function for handling changes in elements.
elemType | [in] This structure contains the various parameters identifying the element the notification is for. |
typedef GSErrCode APILicenseBorrowStatusChangeHandlerProc(API_LicenseBorrowStatusTypeID licenseBorrowStatus) |
User supplied callback procedure for handling license borrowing status changes.
licenseBorrowStatus | [out] The status of license borrowing, can be API_LicenseBorrowed or API_LicenseReturned . |
typedef GSErrCode APILockChangeHandlerProc(const API_Guid &objectId, short ownerId) |
User supplied callback procedure for handling reservation changes of lockable objects.
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. |
typedef GSErrCode APIProjectEventHandlerProc(API_NotifyEventID notifID, Int32 param) |
Callback function to receive notifications on changes of the project.
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 |
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.
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. |
typedef GSErrCode APISelectionChangeHandlerProc(const API_Neig *selElemNeig) |
User supplied callback procedure for handling selection changes.
selElemNeig | [in] This structure identifies the last selected element. |
typedef GSErrCode APIToolChangeHandlerProc(const API_ToolBoxItem *newToolMode) |
Callback function to handle changes in the toolbox.
newToolMode | [in] The toolbox mode the user switched to. |
typedef GSErrCode APIViewEventHandlerProc(const API_NotifyViewEventType *viewEvent) |
User supplied callback function for handling changes of Project Navigator items.
viewEvent | [in] This structure identifies the Project Navigator item and the event the add-on is called for. |
enum API_ElementDBEventID |
Describes the cause of the element notification.
enum API_NavigatorMapID |
Enumeration of Project Navigator maps.
enum API_NotifyEventID |
Possible values for notifications on project events.
Possible values for notifications on Project Navigator events.
GSErrCode ACAPI_Element_AttachObserver | ( | const API_Guid & | elemGuid, |
GSFlags | notifyFlags = 0 |
||
) |
Attaches an observer to the given element.
elemGuid | [in] Identifies the element to attach the observer to. |
notifyFlags | [in] Defines the behavior of the attached observer in certain database operations. |
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.
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. |
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.
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. |
GSErrCode ACAPI_Element_DetachObserver | ( | const API_Guid & | elemGuid | ) |
Detaches the observer from the given element.
elemGuid | [in] Identifies the element to detach the observer from. |
GSErrCode ACAPI_Element_InstallElementObserver | ( | APIElementEventHandlerProc * | handlerProc | ) |
Installs an element observer function which receives notifications on elements' changes.
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. |
GSErrCode ACAPI_Licensing_CatchLicenseBorrowStatusChange | ( | APILicenseBorrowStatusChangeHandlerProc * | handlerProc | ) |
Catches notifications on license borrowing status changes.
handlerProc | [in] The callback function which receives the notifications. |
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.
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. |
GSErrCode ACAPI_Notification_CatchElementReservationChange | ( | APIReservationChangeHandlerProc * | handlerProc, |
const GS::HashSet< API_Guid > * | filterElementsInterestedOnly = nullptr |
||
) |
Sets notification handler for element reservation changes.
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. |
GSErrCode ACAPI_Notification_CatchLockableReservationChange | ( | APILockChangeHandlerProc * | handlerProc, |
const GS::HashSet< API_Guid > * | filterLockablesInterestedOnly = nullptr |
||
) |
Sets notification handler for reservation changes of lockable objects.
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. |
GSErrCode ACAPI_Notification_CatchSelectionChange | ( | APISelectionChangeHandlerProc * | handlerProc | ) |
Turns the monitoring of selection changes on/off.
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. |
GSErrCode ACAPI_Notification_CatchToolChange | ( | APIToolChangeHandlerProc * | handlerProc | ) |
Turns the monitoring of toolbox item changes on/off.
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. |
GSErrCode ACAPI_Notification_CatchViewEvent | ( | GSFlags | eventTypes, |
API_NavigatorMapID | mapId, | ||
APIViewEventHandlerProc * | handlerProc | ||
) |
Register or unregister your add-on to be notified of Project Navigator changes.
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. |
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_GetObservedElements | ( | GS::Array< API_Elem_Head > * | elemHeads | ) |
Returns the elements observed by the add-on.
elemHeads | [out] The headers of the observed elements. |
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.
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. |
GSErrCode ACAPI_Notification_GetTranParams | ( | API_ActTranPars * | actTranPars | ) |
Returns the transformation parameters of the actual edit operation.
actTranPars | [out] The transformation parameters to be returned. |
APINotifyElement_BeginEvents
and the following APINotifyElement_EndEvents
notification. By using this function your add-on is able to update some elements according to the user's edit action. 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.
eventHandler | [in] The event handler to be registered. |
id | [out] The identifier of the successfully registered event handler. |
GSErrCode ACAPI_Notification_UnregisterEventHandler | ( | const API_Guid & | id | ) |
Unregister an event handler from your add-on.
id | [in] The identifier of a previously registered event handler. |
GSErrCode ACAPI_ProjectOperation_CatchProjectEvent | ( | GSFlags | eventTypes, |
APIProjectEventHandlerProc * | handlerProc | ||
) |
Register or unregister your add-on to be notified of application and project events.
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. |