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 > Programming Samples and Tutorials > C++ Samples > Gear Sample
Gear C++ Sample

Gear Sample

Source code for Gear sample is available in Samples\VC folder of the installation directory. If you are going to compile the project we suggest to copy whole VC directory to location outside of the installation folder. Gear is an MFC dialog-based application which displays simplified model of a gear using KernelCAD ActiveX control and allows to modify geometrical parameters of the model.

Gear is rather advanced sample. It demonstrates usage of tree-tier design which includes Geometry layer. This sample differs form Turbine  sample by more realistic and hence more complicated geometry of the model.

Implementation

While analyzing the implementation it is recommended to keep the Gear.glm model open in 3D Debugger to compare. It is even better to use the debugger to watch actual sequence and logic of the application and the parameters returned by the KernelCAD interfaces.

Roles of classes:

CGearDlg - implements the GUI layer. CGearDlg does not know anything about the geometry of the model. It just displays parameters, takes their new values and passes it to the Geometry layer. This work is done in CGearDlg::UpdateObject() method. It also takes display parameters from the geometrical layer and updates the dialog. This is done by CGearDlg::UpdatePage().

Gear class. Gear class implements geometrical layer of the application. It keeps most important parameters of the geometry, which are familiar and useful to the End User . It also knows how to converts these parameters into calls to KernelCAD software interfaces. Another role of the geometry layer is to validate and handle invalid user input.

Note that for simplicity there is no extensive validation of user input. In a real application assertions in implementation should be replaced with more comprehensive input validation and error handling.

See also: All C++ Samples,   All samples