KernelCAD Documentation

DInsight Home
Skip Navigation Links.
Start page
Quick Start
Installation
Overview of the software
What is new
Collapse KernelCAD ModelsKernelCAD Models
Collapse KernelCAD ComponentsKernelCAD Components
KernelCAD Control
KernelCAD .NET Control
Methods and Properties
Menu
Model Explorer
Birds Eye View
Programming
Direct User Access
Direct Operations
Interface Queries
Printing Support
Data Types
Modes of KernelCAD Control
DIObjectGenerator class
Properties
FlatObjectArray Poperty
Context
64 bit development
Dual Mode
Initialisation Context
Overlay Editor
Memory Management
Input validation
Collapse Advanced functionalityAdvanced functionality
Collapse InterfacesInterfaces
Alphabetical list
I3DGrid
I3DBugger
I3Dpt
IAxiBase
IAxis
IBoolSection
IBoolSectionEx
IBoundary
IColor
IConstraint
IData
IDiffSurface_KC
IDIFont
IDraw
IDrawUtil
IDraw2
IElem
IElement
IKCLine
ILightSource
ILocation
ILocationEx
IMaterial
IMetrics
IMetrics2
IModel
IModel2
IModelEx
IPatch
IKCPathCollisionDetector
IProfiles
IPropertyArray
IPropertyArray2
IStdShape
IStrip
ISurface
IText
ITexture
ITransform
IUnknown
Collapse Open Cascade TechnologyOpen Cascade Technology
Collapse DataData
Collapse MovementMovement
Collapse FramesFrames
Collapse Oriented ObjectsOriented Objects
Collapse SectionsSections
Collapse GeneralGeneral
Collapse Topological InterfacesTopological Interfaces
Collapse Viewing InterfacesViewing Interfaces
Collapse Lines And CurvesLines And Curves
Collapse Symmetry InterfacesSymmetry Interfaces
Collapse Clipping plane interfacesClipping plane interfaces
Collapse AlgorithmsAlgorithms
Collapse 2D Geometry2D Geometry
Collapse Programming Samples and TutorialsProgramming Samples and Tutorials
Collapse OverviewOverview
Collapse DeploymentDeployment
Collapse .NET Samples.NET Samples
Collapse C++ SamplesC++ Samples
Collapse Visual Basic SamplesVisual Basic Samples
Collapse Delphi SamplesDelphi Samples
Collapse 3D Debugger3D Debugger
Collapse DeploymentDeployment
Licensing
Model Viewer
Open C++ Source
Technical Support
Skip Navigation LinksHome Page > KernelCAD Components > Interfaces > IModelEx
IModelEx Interface

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 KernelCAD control. This interface can be used to load models, which are created as instances of the Model COM class independently of the KernelCAD 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 .glm 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 .glm files in componets which are not part of KernelCAD 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 .glm 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 .glm files in componets which are not part of KernelCAD 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:

KernelCAD 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 KernelCAD component on various model modifications. This method allows application to modify the flag


HRESULT IsPersistModified(VARIANT_BOOL* modified)

Remarks:

KernelCAD 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