Clip C# Sample
Source code for Clip sample is available in Samples\NET\C#
folder of the installation directory.
Clip is a simple application, which demonstrates programming of
Clipping Planes.
The application
The application loads Clip.mdg model. The model has Cylinder, Cone and Box as
its top objects. Sphere object is a child of Cone. The form of the application
displays properties of the first clipping plane of the Cone object.
When Share check box is on the clipping plane is shared with the Cylinder and
the Box. In this case changes in location or orientation of the plane affect
immediately all three objects. When the plane is shared it becomes global object
in the model, which reflected in coordinates. When the plane is not shared
coordinates of the plane are relative to the local frame of its owner (Cone).
Otherwise coordinates are global.
Children check box is connected to the "IncludeChildren" property of the
Clipping Plane. When it is on the sphere is getting clipped by the plane too.
Implementation
All DG Kernel related code is contained in the ClipForm class. Location and
orientation of the plane are controlled via IAxis
interface queried form ISection
of the Cone.
The only non-trivial part is the implementation of sharing. It is implemented
in OnCheckShare.handler. Call to
IClipPlane.Share makes the plane global and available for use by any other
object in the model.
IClipPlane.UseShared called for clipping planes of both Cylinder and Box
objects force the shared plane to be used as the first plane of the objects.
See also:
All samples
|