ModelHistory Class |
The ModelHistory class provides history information about the objects of the model
that is currently open in Tekla Structures.
Inheritance Hierarchy
Namespace: Tekla.Structures.Model.History
Assembly: Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2023.0.3
Syntax
The ModelHistory type exposes the following members.
Methods
Name | Description | |
---|---|---|
GetCurrentModificationStamp | Obsolete.
Gets the current modification stamp from the model.
| |
GetDeletedObjects | Obsolete.
Gets a list of the objects that have been deleted after the modification stamp.
| |
GetDeletedObjectsWithType | Obsolete.
Gets based on type a list of the objects that have been deleted after the modification stamp.
| |
GetLocalChanges | Get changes which are not written out. | |
GetModifications(String, ModificationStamp) | Lookup modifications since previous call of TakeModifications() without resetting the modstamp | |
GetModifications(String, IEnumerableModelObjectModelObjectEnum, ModificationStamp) | Lookup modifications since previous call of TakeModifications() without resetting the modstamp, with object type filtering | |
GetModifiedObjects | Obsolete.
Gets a list of the objects that have been added or modified after the modification stamp.
| |
GetModifiedObjectsWithType | Obsolete.
Gets based on type a list of the objects that have been added or modified after the modification stamp.
| |
GetNotSharedObjects | Get object which are was created or modified since last ModelSharing WriteOut. | |
TakeModifications(String, ModificationStamp) | Take modifications since previous call. | |
TakeModifications(String, IEnumerableModelObjectModelObjectEnum, ModificationStamp) | Take modifications since previous call, with object type filtering. | |
UpdateModificationStampToLatest |
Updates the modification stamp to latest.
|
Examples
using Tekla.Structures.Model; using Tekla.Structures.Model.History; using System; using System.Diagnostics; using Tekla.Structures.Geometry3d; public class Example1 { /// to be called before modifications private void Init() { ModelHistory.TakeModifications("Example1_ModStamp"); } /// to be called when need to handle modifications private void Run_TakeModifications() { var Modifications = ModelHistory.TakeModifications("Example1_ModStamp"); while (Modifications.Modified.MoveNext()) { ModelObject mo = Modifications.Modified.Current; Console.WriteLine("Run_TakeModifications: Modified id: {0}", mo.Identifier.GUID); } } /// to be called when need to preview modifications without advancing modstamp private void Run_GetModifications() { var Modifications = ModelHistory.GetModifications("Example1_ModStamp"); while (Modifications.Modified.MoveNext()) { ModelObject mo = Modifications.Modified.Current; Console.WriteLine("Run_GetModifications: Modified id: {0}", mo.Identifier.GUID); } } /// this takes each modification only once public void ModificationProcessed() { this.Init(); new Beam(new Point(), new Point(0, 0, 1000)) { Name = "BEAM1", Profile = new Profile() { ProfileString = "HEA400" }, Material = new Material() { MaterialString = "Steel_Undefined" } }.Insert(); new Model().CommitChanges(); this.Run_TakeModifications(); // prints BEAM1 new Beam(new Point(), new Point(0, 0, 1000)) { Name = "BEAM2", Profile = new Profile() { ProfileString = "HEA400" }, Material = new Material() { MaterialString = "Steel_Undefined" } }.Insert(); new Model().CommitChanges(); this.Run_TakeModifications(); // prints BEAM2, but not BEAM1 } /// this always returns all modifications since last TakeModifications() public void ModificationPreviewed() { this.Init(); new Beam(new Point(), new Point(0, 0, 1000)) { Name = "BEAM1", Profile = new Profile() { ProfileString = "HEA400" }, Material = new Material() { MaterialString = "Steel_Undefined" } }.Insert(); new Model().CommitChanges(); this.Run_GetModifications(); // prints BEAM1 new Beam(new Point(), new Point(0, 0, 1000)) { Name = "BEAM2", Profile = new Profile() { ProfileString = "HEA400" }, Material = new Material() { MaterialString = "Steel_Undefined" } }.Insert(); new Model().CommitChanges(); this.Run_GetModifications(); // prints both BEAM1 and BEAM2 } }
See Also