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


Light C++ Sample

Overview

Source code for DIView 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. Light is a simple MFC dialogue-based application, which displays Light.mdg model. It demonstrates programmatic manipulation of properties of lighting. 

Implementation

All the work is done inside CLightDlg class. CLightDlg::OnInitDialog() retrieves IArray interface, controlling the array of all lights in the model. The IArray is obtained as "LightSourceArray" property from IPropertyArray, which in turn is queried from IModel interface. The IArray pointer is kept in m_pIArrLights member of the dialogue class. 

The ILightSource interface m_pILightSource implemented by the current light source is retrieved in CLightDlg::UpdateSourceInfo().

New lights are added or removed in CLightDlg::SetLightSourceCount(int nCount) using methods of IArray.

Tools > "Modify Popup Menu" menu option starts CustomizeMenuDlg which uses IMenu_KC and IMenuItem_KC to manipulate the menu.

Notice also the CLightDlg::OnKernelCADEvent DG Kernel Event handler, which intercepts the menu commands. When user selects Surface or Wireframe commands the handler updates the relevant radio buttons on the dialogue to keep it synchronized with the component state. Notice also how the Save As command is blocked by param1->boolVal = VARIANT_TRUE; because the command is handled by the application itself.

See also ILightSource, Visual C++ Samples,    All samples.