MiniCAD Sample
Source code for MiniCAD sample is available in Samples\NET\VB
folder of the installation directory. MiniCAD is a form-based application which
displays DI model using DG Kernel ActiveX control and allows to modify geometrical parameters of the
model.
See also: C# MiniCAD Sample,
Visual C++ MiniCAD Sample,
All samples
Description
Implementation
Almost all functionality is implemented by MiniCADForm class. Navigation through the interface
hierarchy is the most important task. InitModelInfo() sub retrieves IModel
interface, which is stored in m_iModel field.
m_iModel = axKernCADnet1.GetModel();
Interface to the current
entity is kept into m_iEntity. It is obtained by UpdateSectInfo() sub using call
m_iEntity = m_iModel.GetEntity(m_nCurSect);
The same sub MiniCADForm.UpdateSectInfo() acquires IAxiBase
interface using call
m_iAxiBase = (KernCADnet.IAxiBase)m_iEntity;
Prior to that we query the entity type with
m_strSectType = m_iEntity.GetEntityType();
to check if the entity is a "3DSection". Otherwise it is a Surface
of Revolution, which does not have base.
We can query two more interfaces, namely
I3DObject and IStrip from m_iEntity. This is the last job done in MiniCADForm.UpdateSectInfo(). Note that IStrip
interface m_iStrip is
implemented by object which represents cross-entity segment strip in case of
Generic 3D Entity and profile segment strip in case
of Surface Of Revolution.
Actual geometry changes are done in buttonApply_Click()
handler through
IElement interfaces
which are kept in m_iElemJoint and m_iElemSegment members. These are
obtained by UpdateJointInfo() and UpdateSegmentInfo() methods.
The best method to analyze the implementation is to step through the
code in debugger, starting from MiniCADForm_Load() handler.
|