Events Class |
Namespace: Tekla.Structures.Model
Assembly: Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2023.0.3
The Events type exposes the following members.
Name | Description | |
---|---|---|
InitializeLifetimeService |
Initializes the lifetime service.
(Overrides MarshalByRefObjectInitializeLifetimeService.) | |
OnInterrupted |
Called when uesr interrupts.
| |
OnModelSaveInfo |
Called when model is saved.
| |
Register |
Registers the instance to listen to the specified events.
More event delegates should not be added without calling UnRegister
first.
| |
UnRegister |
Unregisters the instance from listening to events.
|
Name | Description | |
---|---|---|
ClashCheckDone |
The ClashCheckDone event is raised just after clash check is completed.
| |
ClashDetected |
The ClashDetected event is raised just after the detection of each clash.
The clash information is saved before the event is triggered.
| |
CommandStatusChange |
The CommandStatusChange event is raised when a command is started/ended.
| |
Interrupted |
Occurs when user interrupts.
| |
ModelChanged | Obsolete.
The ModelChanged event is raised just after some changes have been made to the model.
Note, this event is however not triggered when UNDO or REDO are performed. | |
ModelLoad |
The ModelLoad event is raised just after a model has been loaded.
| |
ModelLoadInfo |
The ModelLoadInfo event is raised just after a model has been loaded with the model load information as a string parameter.
| |
ModelObjectChanged |
The ModelObjectChanged event is raised just after some changes have been made to the model objects.
Note, this event is triggered when UNDO or REDO are performed!! | |
ModelObjectNumbered |
The ModelObjectNumbered event is raised when model object is numbered.
| |
ModelSave |
The ModelSave event is raised just after a model has been saved.
| |
ModelSaveAs |
The ModelSaveAs event is raised just after a model has been saved using save as.
| |
ModelSaveInfo |
The ModelSave event is raised just after a model has been saved with the model save information as a string parameter.
| |
ModelUnloading |
The ModelUnloading event is raised just before the model is unloaded.
| |
Numbering |
The Numbering event is raised just after a model has been numbered.
| |
ProjectInfoChanged |
The ProjectInfoChanged event is raised just after some changes have been made to the project info.
Note, this event is however not triggered when UNDO or REDO are performed. | |
SelectionChange |
The SelectionChange event is raised when the user changes the current selection inside Tekla Structures.
| |
TeklaStructuresExit |
The TeklaStructuresExit event is raised just before Tekla Structures exits. After this event has been called
the user will no longer be able to perform any calls to Tekla Structures.
| |
ViewCameraChanged |
Occurs when view camera is changed.
|
Registered event handlers are called asynchronously so that many handlers may be running simultaneously. Event handlers are not guaranteed to be run in the same thread where they were registered. The asynchronous nature of the events requires the use of synchronization constructs on objects and data structures that are not defined to be thread safe.
- Microsoft's documentation about the lock statement: http://msdn.microsoft.com/en-us/library/c5kehkcz.aspx
- Microsoft's documentation about delegates: http://msdn.microsoft.com/en-us/library/900fyy8e.aspx
- Microsoft's documentation about managed threading: http://msdn.microsoft.com/en-us/library/1c9txz50.aspx
using Tekla.Structures.Model; public class Example { private Tekla.Structures.Model.Events _events = new Tekla.Structures.Model.Events(); private object _selectionEventHandlerLock = new object(); private object _changedObjectHandlerLock = new object(); public void RegisterEventHandler() { _events.SelectionChange += Events_SelectionChangeEvent; _events.ModelObjectChanged += Events_ModelObjectChangedEvent; _events.Register(); } public void UnRegisterEventHandler() { _events.UnRegister(); } void Events_SelectionChangeEvent() { /* Make sure that the inner code block is running synchronously */ lock(_selectionEventHandlerLock) { System.Console.WriteLine("Selection changed event received."); } } void Events_ModelObjectChangedEvent(List<ChangeData> changes) { /* Make sure that the inner code block is running synchronously */ lock (_changedObjectHandlerLock) { foreach(ChangeData data in changes) System.Console.WriteLine("Changed event received " + ":" + data.Object.ToString() + ":" + " Type" + ":" + data.Type.ToString() + " guid: " + data.Object.Identifier.GUID.ToString()); System.Console.WriteLine("Changed event received for " + changes.Count.ToString() + " objects"); } } }