DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Collapse ModelsModels
Collapse DG Kernel ControlsDG Kernel Controls
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Collapse General GeometryGeneral Geometry
Collapse ModelModel
Collapse ViewView
Collapse General ComputingGeneral Computing
Collapse ViewsViews
Collapse Samples and TutorialsSamples and Tutorials
Collapse GraphicsGraphics
Collapse Math ObjectsMath Objects
Collapse DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation Links Go to DGKC docs Search Documentation


IModelEx Interface

Load
Save
LoadEx
SaveEx
LoadFromMemory
SaveToMemory
SetPersistModified
IsPersistModified

IModelEx is an extension of the IModel interface. Normally loading of a model is done via the "ModelPath" property of the DG Kernel control. This interface can be used to load models, which are created as instances of the Model COM class independently of the DG Kernel component .

See also Object Array Sample, IModel , Interface List


HRESULT Load(char* szFilePath)

Parameters

szFilePath - [in] path of the model file.

Returns

S_OK in case of success.

ERROR_OPEN_FAILED - if the operation failed for some reason.


HRESULT Save(char* szFilePath)

Parameters

szFilePath - [in] path of the model file.

Returns

S_OK in case of success.

STG_E_CANTSAVE - if the operation failed for some reason.


HRESULT LoadEx(char* szFilePath, IDataContext* options)

Parameters

szFilePath - [in] path of the model file.

options - [in] Options for importing the file. 

Returns

S_OK in case of success.

ERROR_OPEN_FAILED - if the operation failed for some reason.

Remarks:

options allow setting file import options for data of different from .mdg CAD types. Actual interface supplied for options is normally has more derived type. See ISTLDataContext for an example. 

IDataContext or ISTLDataContext can be queried from IModel or from IModelEx interface itself

Note: This method ignores options parameter and accepts only .mdg files in componets which are not part of DG Kernel Enterprise product


HRESULT SaveEx(char* szFilePath, IDataContext* options)

Parameters

szFilePath - [in] path of the model file.

options - [in] Options for saving/exporting the file. 

Returns

S_OK in case of success.

STG_E_CANTSAVE - if the operation failed for some reason.

Remarks:

options allow setting export options for data of different from .mdg CAD types. Actual interface supplied for options is normally has more derived type. See ISTLDataContext for an example.  

IDataContext or ISTLDataContext can be queried from IModel or from IModelEx interface itself

Note: This method ignores options parameter and accepts only .mdg files in componets which are not part of DG Kernel Enterprise product


HRESULT LoadFromMemory(SAFEARRAY **data, int format)

Parameters

data - [in] Input array of byte type containing binary data of a model. See remarks for more detail.

format - [[in] Indicates CAD format in which the model is stored. Valid values for Enterprise products are enumerated by ECADFormat enumeration. For products other than Enterprise level format must be set to 0.

Returns

S_OK in case of success.

DISP_E_PARAMNOTOPTIONAL - if the data array was invalid or its elements have type other than byte

E_FAIL - if the operation failed. The most probable reason for that is that the data supplied was not in the correct format for the specified format parameter.

Remarks:

This method allows initialisation of a model from data stored in memory. This is useful in some situation, for example when the model is stored as part of the applications document file. The data buffer must have byte element type and contain valid data. An example of a valid data is a valid model file loaded in memory.  

The SAFEARRAY type normally interpreted by development environments as a simpler type. In Visual Basic, for example, it is interpreted by the Object Browser as Byte() array of bytes. See SAFEARRAY topic for discussion and sample of its usage in C++/C language.


HRESULT SaveToMemory(SAFEARRAY **data, int format)

Parameters

data - [in] Input array of byte type containing binary data of a model. See remarks for more detail.

format - [in] Indicates CAD format in which the model is stored. Valid values for Enterprise products in this release are: 0-GLM, 1-VRML, 2-STL. These values are enumerated by ECADFormat enumeration. For products other than Enterprise level format must be set to 0.

Returns

S_OK in case of success.

DISP_E_PARAMNOTOPTIONAL - if the data in NULL

E_OUTOFMEMORY - if buffer to hold the data can not be allocated.

Remarks:

This method returns a copy of persistent data of the current model in memory. This is useful in applications, which store model as part of the applications document file. On return the data buffer will contain data identical to contents of a file stored after one of the Save methods above. The data array is allocated by the method.

The SAFEARRAY type normally interpreted by development environments as a simpler type. In Visual Basic, for example, it is interpreted by the Object Browser as Byte() array of bytes. See SAFEARRAY topic for discussion and sample of its usage in C++/C language.


HRESULT SetPersistModified(VARIANT_BOOL modified)

Remarks:

DG Kernel models maintain a Boolean variable which indicates whether there were modifications in the model, which should be saved on closing the application. The flag is false by default and is set to true inside DG Kernel component on various model modifications. This method allows application to modify the flag


HRESULT IsPersistModified(VARIANT_BOOL* modified)

Remarks:

DG Kernel models maintain a Boolean variable which indicates whether there were modifications in the model, which should be saved on closing the application. This method returns the flag. It is up to the application to check this flag before closing or loading a different model