Home Page > Programming Samples and Tutorials > .NET Samples > C# Samples > MiniCAD Sample
.NET CS MiniCAD Sample
MiniCAD Sample
Source code for MiniCAD sample is available in Samples\NET\C#
folder of the installation directory. MiniCAD is a form-based application which
displays DI model using KernelCAD ActiveX control and allows to modify geometrical parameters of the
model.
See also Visual Basic .NET MiniCAD Sample
C++ MiniCAD Sample, C# Samples,
All samples
Description of MiniCAD
Sample
Implementation
Almost all functionality is implemented by MiniCADForm class. Navigation through the interface
hierarchy is the most important task. InitModelInfo() method retrieves IModel
interface, which is stored in m_iModel field.
m_iModel = axKernCADnet1.GetModel();
Interface to the current
section is kept into m_iSection. It is obtained by UpdateSectInfo()
method, using call
m_iSection = m_iModel.GetSection(m_nCurSect);
The same method MiniCADForm.UpdateSectInfo() acquires IAxiBase
interface using call
m_iAxiBase = (KernCADnet.IAxiBase)m_iSection;
Prior to that we query the section type with
m_strSectType = m_iSection.GetSectionType();
to check if the section 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_iSection. This is the last job done in MiniCADForm.UpdateSectInfo(). Note that IStrip
interface m_iStrip is
implemented by object which represents cross-section segment strip in case of
Generic 3D Object 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.
|