User Data
Entities in DG Kernel models can store a user-defined integer number and a user-defined variable length string. See details at
Object User Data.
The topic below describes how more complicated formatted data can be stored with
the model.
Unformatted User Data Stream
KerrnelCAD models maintain a raw data buffer for usr-defined unformatted data.
The data can be either binary or textual and can have any size.
Access to the stream is implemented via
IBlob interface. To obtain the interface query
IPropertyArray of the model via
IModel >
IPropertyArray and use IPropertyArray.GetProperty("RawUserData")
to obtain an interface, which has actual type of (can be safely cast to)
IBlob.
To embed a file into the model: Obtain
IBlob as described above. Call
IBlob.Load() to embed the file
To save the data to a file: Obtain
IBlob as described above and call
IBlob.Save()
To obtain or modify the data in memory obtain
IBlob as described above and.use
IBlob.Copy() or IBlob.CopyTo()
methods which read or modify the data as an array of bytes.
To clear the data stream query
IPropertyArray of the model via
IModel >
IPropertyArray and call IPropertyArray.SetProperty("RawUserData",
NULL).
See also: User Data Sample,
User Data Table
Independently of the above Unformatted User Data Stream, every DG Kernel model keeps a mini data base, which currently consist of a
single data table. The data table can be used to store any application-specific
data relevant to
the model or separate objects like model and object description and
possibly some links or references to external data. The data table is
stored into the .mdg file with the rest of information about the model.
By default DG Kernel models do not have the table. It can be created with
IDataSourceCreateTable
and deleted with IDataSource.DropTable()
to reduce the model size.
Currently records of the table can have double, long, unsigned integer or
string type.
Record of the table can have arbitrary structure, which uses above types.
The structure can be modified dynamically with the help of IDataTable
interface.
IDataSource, which represents the data
base itself, is the top-level interface in the user data hierarchy, from
which all other interfaces can be queried.
Object User Data
value can be used to identify objects a records is related to.
Use
IDataSource - to create,
delete or query existence of the data table.
IDataTable - to setup or
modify structure of the table. To add or delete fields of different types.
IRecordSet - to add new
or remove records.
IData - to query data from the table
IDataMods, - to modify
data in existent records
See also: User Data Sample,
Object User Data,
IDataSource,
IDataTable,
IData,. IDataMods,
IRecordSet
|