Pipes Sample
Overview
Implementation
Model of the sample is constructed dynamically at runtime so the ModelPath
property of the DG Kernel control is empty. Construction of the model starts in UpdateModelInfo
function.
In DefineCentralCurveGeometry() ICurveFreeForm::GetData() is used to asses
IArray3D
of data points. After which the central line is an arc or radius 100 in x, z plane from (0, 100, 0) to (-100, 100, 100) extended with
a straight line from (100, -200, 0) to (100, 0, 0) and an arc or radius 100 in
x, y plane from (100, 0, 0) to (0, 100, 0).
Notice the way array of spline frames
IFrameArray
is accessed in PipesDlg::UpdateSplineFrame().
SplineDlg::UpdateFrameInfo() repeats the action. The obtained frame is used
in SplineDlg::ToGlobal() to convert local 2D coordinates in x , y in the plane
to global coordinates.
PipesDlg::OnClientDraw() is probably the least intuitive places in the
program. As geometry of the curve is defined relative to the local frame of the
pipe it is simple to make the frame current using IDraw2::SetCurrentFrame().
The same procedure is repeated in PipesDlg::DrawSplineAttributes() to draw the
local frame of the spline.
|