Cross View Sample
The sample demonstrates different methods of calculation and display of
intersection of 3D objects with a 3D plane.
Running the application
The application has two DG Kernel components on the form. The left control
shows model of a pipe. The control on the right-hand side shows cross-section of
the pipe with a plane.
Plane is rendered transparent in the left control. Position and orientation
of the plane can be set arbitrary using Location and Normal edit boxes.
The Apply button updates position of the plane in 3D view
"Update Cross-Entity View" button recalculates the intersection line and
displays in in the right hand side control.
The implementation group gives choice of three different methods of
calculation and display of the intersection.
The control on the right-hand side is pure
two dimensional view when High or Mid implementation is chosen. In Low
implementation mode the control in the right is three dimensional, but rotation
is disabled so it is effectively two dimensional display. Pure 2D mode renders a
grid to show dimensions and position. Advantage of Low level mode is that the 2D
view has zoom and pan operations.
The "Approximate X Axis" group defines direction of x axis in the plane.
Changing the direction will appear like rotation of 2D view around center of the
window. Orientation of axes of the
2D View Frame inside the
plane is shown using small axes in 3D View
Application Design
The application demonstrates three different methods of implementation: High,
Mid and Low Level.
High level implementation involves the minimal amount of programming. The 2D
picture is generated automatically.
Mid and low level implementation offer on the other hand more flexibility for
possible modifications of the displayed scene and demonstrates access to
coordinates of points on the line.
In Mid and Low level mode the intersection line is calculated in
UpdateCrossSectionView() of the form/dialog using
IBoolSectionEx.Execute
with operation parameter set to
EBooleanOperation.eBoolOpInters
Mid level implementation adds intersection line directly to the 2D View using
Direct Definition
method.
Low level implementation creates replicas of intersection lines using
IObject_KC.Replicate
and adds them without a change to 3D model of the control on the right hand
side. To simulate two dimensional view Eye
Frame of the view is modified to align it with normal of the cross-section
plane in LowImplementation.AlignViewPlane(). Scene rotations are
disabled in Init() method of the form/dialog
Implementation
C++
Visual
Basic 6
|