StripTopol Sample
Source code for StripTopol 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.
StripTopol is a simple MFC dialog-based application, which demonstrates
topological operations performed programmatically on strips of surface patches.
See also Visual C++ Samples, All samples
Running the application
On load the application displays the default model (cube). For simplicity the
application displays and modifies information related to the first top level
object in the model (see Structure of DInsight models). Controls on the right
display properties of the surface strip in the object. "Joint" edit
boxes allow modification of the current joint. In case of Generic 3D Entity
the modification will be applied at the current z position, which is in the middle
by default.
The menu contains topological commands which modify structure of the surface
strip. It is important to remember that edges are numbered in CCW direction when
looking from the end of the local Z axis. This can be verified by changing
coordinate in "Joint" edit boxes. Number of a surface patch is the
number of its first edge in the same direction.
New Knot command allows increasing number of knots in the axial base, hence increasing
degree of freedom for modifications along z axis. Note that this command has no
meaning for Surface Of Revolution objets as those do not have axial base.
File submenu allows saving and loading models.
Implementation
Similar to MiniCAD sample, retrieving
parameters of the model and their modification is done in Update...() set of
methods. The key interface IStripTopol is retrieved in
CStripTopDlg::UpdateEntityInfo() from IStrip interface of the current object
and stored in m_pIStripTopol member variable. All topological commands except
"New Knot" end with a call to a method of IStripTopol.
CStripTopDlg::OnNewKnot() , which is the "New Knot" command
handler, retrieves IArray interface, implemented by the object, via
IAxiBase.
Actual insertion is performed in AxiBaseDlg::OnOK() handler with a call to InsertAt()
method of IArray.
Suggested Exercises
1. Modify AxiBaseDlg dialog to allow entering position of a new knot.
2. Add ability to change the current object in the model.
(See MiniCAD and Object Array samples)
3. Add ability to switch between wire frame and solid display modes.
|