Class EsentModel
IModel implementation for Esent DB based model support
Inheritance
System.Object
EsentModel
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Xbim.IO.Esent.dll
Syntax
public class EsentModel : IModel, IFederatedModel, IDisposable
Constructors
|
Improve this Doc
View Source
EsentModel(IEntityFactory)
Declaration
public EsentModel(IEntityFactory factory)
Parameters
Fields
|
Improve this Doc
View Source
InstanceCache
Declaration
protected PersistedEntityInstanceCache InstanceCache
Field Value
Properties
|
Improve this Doc
View Source
AllInstancesHandles
Returns an enumerable of the handles to all entities in the model
Note this includes entities that are in any federated models
Declaration
public IEnumerable<XbimInstanceHandle> AllInstancesHandles { get; }
Property Value
|
Improve this Doc
View Source
CanEdit
Declaration
public bool CanEdit { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
CodePageOverride
Declaration
public int CodePageOverride { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Examples
model.CodePageOverride = Encoding.Default.WindowsCodePage;
|
Improve this Doc
View Source
CurrentTransaction
Declaration
public ITransaction CurrentTransaction { get; }
Property Value
|
Improve this Doc
View Source
DatabaseName
Declaration
public string DatabaseName { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
EntityCache
Declaration
public IEntityCache EntityCache { get; }
Property Value
|
Improve this Doc
View Source
Factory
Declaration
public IEntityFactory Factory { get; }
Property Value
|
Improve this Doc
View Source
FederatedInstanceHandles
Declaration
public IList<XbimInstanceHandle> FederatedInstanceHandles { get; }
Property Value
|
Improve this Doc
View Source
FederatedInstances
Returns a collection of all instances in the model and all federated instances
Declaration
public IReadOnlyEntityCollection FederatedInstances { get; }
Property Value
|
Improve this Doc
View Source
GeometriesCount
Returns the total number of Geometry objects in the model
Declaration
public virtual long GeometriesCount { get; }
Property Value
Type |
Description |
System.Int64 |
|
|
Improve this Doc
View Source
GeometryManager
Declaration
public IGeometryManager GeometryManager { get; set; }
Property Value
|
Improve this Doc
View Source
GeometryStore
Declaration
public IGeometryStore GeometryStore { get; }
Property Value
|
Improve this Doc
View Source
GeometrySupportLevel
Returns the level of geometry supported in the model
0 = No geometry has been compiled in the model
1 = Triangulated Mesh only
2 = Polygonal geometry meshes supporting maps
Declaration
public int GeometrySupportLevel { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Declaration
public IStepFileHeader Header { get; set; }
Property Value
|
Improve this Doc
View Source
InstanceHandles
Returns a list of the handles to only the entities in this model
Note this do NOT include entities that are in any federated models
Declaration
public IList<XbimInstanceHandle> InstanceHandles { get; }
Property Value
|
Improve this Doc
View Source
Instances
Returns a collection of all instances only in the model
Declaration
public IEntityCollection Instances { get; }
Property Value
|
Improve this Doc
View Source
InverseCache
Declaration
public IInverseCache InverseCache { get; }
Property Value
|
Improve this Doc
View Source
IsFederation
Returns true if the model contains reference models or the model has extension xBIMf
Declaration
public virtual bool IsFederation { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsTransacting
Declaration
public bool IsTransacting { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Logger
Declaration
public ILogger Logger { get; set; }
Property Value
Type |
Description |
Microsoft.Extensions.Logging.ILogger |
|
|
Improve this Doc
View Source
Declaration
public ExpressMetaData Metadata { get; }
Property Value
|
Improve this Doc
View Source
ModelFactors
Model wide factors, precision etc.
Declaration
public IModelFactors ModelFactors { get; protected set; }
Property Value
|
Improve this Doc
View Source
ModelOpenCount
Declaration
public static int ModelOpenCount { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
ReferencedModels
Declaration
public IEnumerable<IReferencedModel> ReferencedModels { get; }
Property Value
|
Improve this Doc
View Source
ReferencingModel
Declaration
public IModel ReferencingModel { get; }
Property Value
|
Improve this Doc
View Source
SchemaVersion
Declaration
public XbimSchemaVersion SchemaVersion { get; }
Property Value
|
Improve this Doc
View Source
Tag
Declaration
public object Tag { get; set; }
Property Value
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
UserDefinedId
An identifier that an application can use to identify this model uniquely
Declaration
public int UserDefinedId { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
|
Improve this Doc
View Source
AddModelReference(IReferencedModel)
Declaration
public void AddModelReference(IReferencedModel model)
Parameters
|
Improve this Doc
View Source
BeginEntityCaching()
Declaration
public IEntityCache BeginEntityCaching()
Returns
|
Improve this Doc
View Source
BeginInverseCaching()
Declaration
public IInverseCache BeginInverseCaching()
Returns
|
Improve this Doc
View Source
BeginTransaction()
Declaration
public XbimReadWriteTransaction BeginTransaction()
Returns
|
Improve this Doc
View Source
BeginTransaction(String)
Declaration
public XbimReadWriteTransaction BeginTransaction(string operationName)
Parameters
Type |
Name |
Description |
System.String |
operationName |
|
Returns
|
Improve this Doc
View Source
CacheClear()
Clears all read data in the cache
Declaration
|
Improve this Doc
View Source
CacheStart()
Begins a cache of all data read from the model, improves performance where data is read many times
Declaration
|
Improve this Doc
View Source
CacheStop()
Stops further caching of data and clears the current cache
Declaration
|
Improve this Doc
View Source
CheckMaps()
Declaration
|
Improve this Doc
View Source
Close()
Closes the current model and releases all resources and instances
Declaration
public virtual void Close()
|
Improve this Doc
View Source
Compact(String)
Declaration
public void Compact(string targetModelName)
Parameters
Type |
Name |
Description |
System.String |
targetModelName |
|
|
Improve this Doc
View Source
CreateDatabase(String)
Declaration
protected void CreateDatabase(string tmpFileName)
Parameters
Type |
Name |
Description |
System.String |
tmpFileName |
|
|
Improve this Doc
View Source
CreateFrom(Stream, Int64, StorageType, String, ReportProgressDelegate, Boolean, Boolean)
Declaration
public virtual bool CreateFrom(Stream inputStream, long streamSize, StorageType streamType, string xbimDbName, ReportProgressDelegate progDelegate = null, bool keepOpen = false, bool cacheEntities = false)
Parameters
Type |
Name |
Description |
System.IO.Stream |
inputStream |
|
System.Int64 |
streamSize |
|
StorageType |
streamType |
|
System.String |
xbimDbName |
|
ReportProgressDelegate |
progDelegate |
|
System.Boolean |
keepOpen |
|
System.Boolean |
cacheEntities |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
CreateFrom(String, String, ReportProgressDelegate, Boolean, Boolean, Nullable<StorageType>, Boolean)
Creates a new Model and populates with instances from the specified file, Ifc, IfcXML, and IfcZip are all supported.
Declaration
public virtual bool CreateFrom(string importFrom, string xbimDbName = null, ReportProgressDelegate progDelegate = null, bool keepOpen = false, bool cacheEntities = false, StorageType? storageType = null, bool deleteOnClose = false)
Parameters
Type |
Name |
Description |
System.String |
importFrom |
Name of the file containing the instances to import
|
System.String |
xbimDbName |
Name of the xbim file that will be created.
If null the contents are loaded into memory and are not persistent
|
ReportProgressDelegate |
progDelegate |
|
System.Boolean |
keepOpen |
Flag indicating whether to keep the model open after creation, otherwise closes after import
|
System.Boolean |
cacheEntities |
|
System.Nullable<StorageType> |
storageType |
The expected Ifc Format of the file. Inferred from extension when null
|
System.Boolean |
deleteOnClose |
Indicates whether the xbim database file should be deleted on close of model
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
CreateFrom(IModel, String, ReportProgressDelegate)
Declaration
public void CreateFrom(IModel model, string fileName, ReportProgressDelegate progDelegate = null)
Parameters
|
Improve this Doc
View Source
CreateModel(IEntityFactory, String, XbimDBAccess)
Creates and opens a new Xbim Database
Declaration
public static EsentModel CreateModel(IEntityFactory factory, string dbFileName, XbimDBAccess access = XbimDBAccess.ReadWrite)
Parameters
Type |
Name |
Description |
IEntityFactory |
factory |
Entity factory to be used for deserialization
|
System.String |
dbFileName |
Name of the Xbim file
|
XbimDBAccess |
access |
|
Returns
|
Improve this Doc
View Source
CreateTemporaryModel(IEntityFactory)
Creates an empty model using a temporary filename, the model will be deleted on close, unless SaveAs is called
It will be returned open for read write operations
Declaration
public static EsentModel CreateTemporaryModel(IEntityFactory factory)
Parameters
Returns
|
Improve this Doc
View Source
DatabaseHasGeometryTable()
Declaration
public bool DatabaseHasGeometryTable()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
DatabaseHasInstanceTable()
Declaration
public bool DatabaseHasInstanceTable()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Delete(IPersistEntity)
Registers an entity for deletion
Declaration
public void Delete(IPersistEntity instance)
Parameters
|
Improve this Doc
View Source
DeleteGeometryCache()
Declaration
public bool DeleteGeometryCache()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Dispose()
Declaration
|
Improve this Doc
View Source
Dispose(Boolean)
Declaration
protected void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
System.Boolean |
disposing |
|
|
Improve this Doc
View Source
EnsureGeometryTables()
Invoke the function before meshing to ensure database structure is available
Declaration
public bool EnsureGeometryTables()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
EnsureUniqueUserDefinedId()
Declaration
public void EnsureUniqueUserDefinedId()
|
Improve this Doc
View Source
Finalize()
Declaration
protected void Finalize()
|
Improve this Doc
View Source
ForEach<TSource>(IEnumerable<TSource>, Action<TSource>)
Performs a set of actions on a collection of entities inside a single read only transaction
This improves database performance for retrieving and accessing complex and deep objects
Declaration
public void ForEach<TSource>(IEnumerable<TSource> source, Action<TSource> body)
where TSource : IPersistEntity
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<TSource> |
source |
|
System.Action<TSource> |
body |
|
Type Parameters
|
Improve this Doc
View Source
FreeTable(EsentEntityCursor)
Returns the table to the cache for reuse
Declaration
public void FreeTable(EsentEntityCursor table)
Parameters
|
Improve this Doc
View Source
FreeTable(EsentShapeGeometryCursor)
Returns the table to the cache for reuse
Declaration
public void FreeTable(EsentShapeGeometryCursor table)
Parameters
|
Improve this Doc
View Source
FreeTable(EsentShapeInstanceCursor)
Returns the table to the cache for reuse
Declaration
public void FreeTable(EsentShapeInstanceCursor table)
Parameters
|
Improve this Doc
View Source
FreeTable(XbimGeometryCursor)
Returns the table to the cache for reuse
Declaration
public void FreeTable(XbimGeometryCursor table)
Parameters
|
Improve this Doc
View Source
GetEntityBinaryData(IInstantiableEntity)
Declaration
public byte[] GetEntityBinaryData(IInstantiableEntity entity)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetGeometryData(IEnumerable<XbimGeometryHandle>)
Declaration
public IEnumerable<XbimGeometryData> GetGeometryData(IEnumerable<XbimGeometryHandle> handles)
Parameters
Returns
|
Improve this Doc
View Source
GetGeometryData(Int32)
Declaration
public XbimGeometryData GetGeometryData(int geomLabel)
Parameters
Type |
Name |
Description |
System.Int32 |
geomLabel |
|
Returns
|
Improve this Doc
View Source
GetGeometryData(Int32, XbimGeometryType)
Returns all the geometries for the geometry type
Typically bounding box returns a single object, triangulated mesh mes may return multiple geometry meshes
where an object is made of multiple materials
Declaration
public IEnumerable<XbimGeometryData> GetGeometryData(int productLabel, XbimGeometryType geomType)
Parameters
Returns
|
Improve this Doc
View Source
GetGeometryData(XbimGeometryType)
Declaration
public IEnumerable<XbimGeometryData> GetGeometryData(XbimGeometryType ofType)
Parameters
Returns
|
Improve this Doc
View Source
GetGeometryData(XbimGeometryHandle)
Declaration
public XbimGeometryData GetGeometryData(XbimGeometryHandle handle)
Parameters
Returns
|
Improve this Doc
View Source
GetGeometryHandle(Int32)
Declaration
public XbimGeometryHandle GetGeometryHandle(int geometryLabel)
Parameters
Type |
Name |
Description |
System.Int32 |
geometryLabel |
|
Returns
|
Improve this Doc
View Source
GetGeometryHandles(XbimGeometryType, XbimGeometrySort)
Declaration
public XbimGeometryHandleCollection GetGeometryHandles(XbimGeometryType geomType = XbimGeometryType.TriangulatedMesh, XbimGeometrySort sortOrder = XbimGeometrySort.OrderByIfcSurfaceStyleThenIfcType)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public static IStepFileHeader GetStepFileHeader(string fileName)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
Returns
|
Improve this Doc
View Source
Init(IEntityFactory)
Declaration
protected void Init(IEntityFactory factory)
Parameters
|
Improve this Doc
View Source
Implementation of IModel variant of InsertCopy() function
Declaration
public T InsertCopy<T>(T toCopy, XbimInstanceHandleMap mappings, PropertyTranformDelegate propTransform, bool includeInverses, bool keepLabels)
where T : IPersistEntity
Parameters
Type |
Name |
Description |
T |
toCopy |
Object to copy
|
XbimInstanceHandleMap |
mappings |
Mappings make sure object is only inserted once. You should use one instance of mappings for all InsertCopy() calls between two models
|
PropertyTranformDelegate |
propTransform |
Delegate which can be used to transform properties. You can use this to filter out certain properties or referenced objects
|
System.Boolean |
includeInverses |
If TRUE interse relations are also copied over. This may potentially bring over almost entire model if not controlled by propTransform delegate
|
System.Boolean |
keepLabels |
If TRUE entity labels of inserted objects will be the same as the labels of original objects. This should be FALSE if you are inserting objects to existing model
or if you are inserting objects from multiple source models into a single target model where entity labels may potentially clash.
|
Returns
Type |
Description |
T |
New created object in this model which is a deep copy of original object
|
Type Parameters
Name |
Description |
T |
Type of the object to be inserted. This must be a type supported by this model
|
|
Improve this Doc
View Source
InsertCopy<T>(T, XbimInstanceHandleMap, XbimReadWriteTransaction, Boolean)
Inserts a deep copy of the toCopy object into this model
All property values are copied to the maximum depth
Inverse properties are not copied
Declaration
public T InsertCopy<T>(T toCopy, XbimInstanceHandleMap mappings, XbimReadWriteTransaction txn, bool includeInverses = false)
where T : IPersistEntity
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Declaration
public T InsertCopy<T>(T toCopy, XbimInstanceHandleMap mappings, XbimReadWriteTransaction txn, PropertyTranformDelegate propTransform, bool includeInverses = false)
where T : IPersistEntity
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
NextReferenceIdentifier()
Declaration
protected string NextReferenceIdentifier()
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Open(String, XbimDBAccess, Boolean)
Declaration
protected void Open(string fileName, XbimDBAccess accessMode, bool deleteOnClose)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
XbimDBAccess |
accessMode |
|
System.Boolean |
deleteOnClose |
|
|
Improve this Doc
View Source
Open(String, XbimDBAccess, ReportProgressDelegate)
Opens an Xbim model only, to open Ifc, IfcZip and IfcXML files use the CreateFrom method
Declaration
public virtual bool Open(string fileName, XbimDBAccess accessMode = XbimDBAccess.Read, ReportProgressDelegate progDelegate = null)
Parameters
Returns
Type |
Description |
System.Boolean |
True if successful
|
|
Improve this Doc
View Source
Print()
Declaration
|
Improve this Doc
View Source
SaveAs(String, Nullable<StorageType>, ReportProgressDelegate, IDictionary<Int32, Int32>)
Declaration
public bool SaveAs(string outputFileName, StorageType? storageType = null, ReportProgressDelegate progress = null, IDictionary<int, int> map = null)
Parameters
Type |
Name |
Description |
System.String |
outputFileName |
|
System.Nullable<StorageType> |
storageType |
|
ReportProgressDelegate |
progress |
|
System.Collections.Generic.IDictionary<System.Int32, System.Int32> |
map |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
StopCaching()
Declaration
public void StopCaching()
Events
|
Improve this Doc
View Source
EntityDeleted
This event is fired every time when entity gets deleted from model.
Declaration
public event DeletedEntityHandler EntityDeleted
Event Type
|
Improve this Doc
View Source
EntityModified
This event is fired every time any entity is modified. If your model is not
transactional it might not be called at all as the central point for all
modifications is a transaction.
Declaration
public event ModifiedEntityHandler EntityModified
Event Type
|
Improve this Doc
View Source
EntityNew
This event is fired every time new entity is created.
Declaration
public event NewEntityHandler EntityNew
Event Type
Explicit Interface Implementations
|
Improve this Doc
View Source
IModel.Activate(IPersistEntity)
Declaration
bool IModel.Activate(IPersistEntity entity)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IModel.BeginTransaction(String)
Declaration
ITransaction IModel.BeginTransaction(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
|
Improve this Doc
View Source
IModel.IsTransactional
Declaration
bool IModel.IsTransactional { get; }
Returns
Type |
Description |
System.Boolean |
|
Implements
System.IDisposable