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 > Programming
Programming of KernelCAD Control

Programming of the KernelCAD Control

Manipulation of the current model and its rendering properties is performed via interfaces implemented by KernelCAD control. Interface is a simple notion, which does not require any special knowledge. Interface is a small group of methods (functions) related to a certain functionality. Programming Samples provide ample examples of their usage.

KernelCAD interfaces are organized in a hierarchical fashion. This means that one have to traverse the interface hierarchy tree using casts and other methods to obtain needed interface of a particular object.  IModel is the root interface for geometry-related interfaces, from which all its dependent interfaces can be obtained. To get IModel interface call GetModel method of the control which in C++ case will look like:

IModel * pIModel= (IModel*)m_ctrlCAD.GetModel();

Using casts (or QueryInterface() calls in C++) and other interface methods like IModel::GetSection() interface hierarchy can be traversed to obtain the interface needed and call its methods.

IView interface is the root for functionality related to viewing properties of the control's display rather than geometry of the model. IView reference is returned by GetView() method of the control. 

In unmanaged environments like native C++ or VB, every interface reference, obtained with the QueryInterface() or a call to an interface method, should be released with a call to Release() method, like pIModel->Release(), when it is no longer needed. In Visual Basic this operation looks like: 

Set iMyInterface = Nothing.

C++ interface declarations are available in DIInterface.h located in Samples\Vc\Include directory of the installation folder. The same folder contains DIError.h with declarations of error codes specific to DInsight software. All other return codes for interface methods are contained in Winerror.h - the standard header file of your development environment. If you cannot find one on your machine use copy from Samples\Vc\Include directory of this product installation folder. 

Microsoft Visual Basic and Microsoft Visual Studio .NET detect control's interfaces and types automatically after the control has been added to the project. To access this information open Object Browser and activate KernelCADTypeLib set.

Advanced: KernelCAD software slightly deviates from the COM standard. Traversing the Interface Hierarchy can obtain interface implemented by an object different from the original one. This means that result of a query depends on the query path. For example for a Generic 3D Object  path ISection-> IArray returns IArray of its child sections, but path ISection->IAxiBase->IArray returns IArray of its base knots. See also Interface queries

See also: User Input Validation