Pick Sample
Pick is a form application, which
displays Light.mdg model. It demonstrates programming and handling
selection of objects in 3D view by the end user.
The sample shows four different implementations of object
selection based on
three different approaches.
Running the application
There are three groups of controls in the application related to three
different ways of identification of the object at a point of the
screen.
Method one (Controls at the bottom): The DG Kernel Component can run in two
modes: View and Modify. This is
reflected by "Mode" radio buttons on the form of the application. In
View mode the control works as normal rendering the model in 3D with rotation,
zoom and pan. When "Select" option is on, mouse movements are blocked
and mouse clicks are processed for selection of 3D objects in the view. Name of
the selected object is displayed on the form.
Method two (Top right group of controls): It demonstrates a low-level
detection of an object using GetItemAt
method of IPick_DG interface. Its edit boxes allow entering the current screen position. The
point on the screen is displayed in the window with cross-hair lines. Pressing
the "Detect Object" button will display name of the object at the
point or "No Object" text with green color.
Method three (Mouse Hovering group of controls): It demonstrates an efficient
way to display the object name using the GetItemAt
method and MouseHover event triggered by
the component similarly to tool tips in Windows User Interface. To see it in
action, place the mouse pointer over different objects in 3D view without clicking and see the blue label showing name of the object.
For the last two methods the "Current surface point" group displays
coordinates of the selected point on the surface of the object. The radio
buttons allow choosing axes, relative to which the coordinates are calculated.
When "Local Frame" option is selected the coordinates are relative to
the local frame of the picked object.
Method four (Multiple Object Selection group of controls): It demonstrates
multiple object selection
via a selection rectangle and handling the notification event. To select several objects, turn on
the "Notification Enabled" check box. In context menu of the DG Kernel control select
Advanced>Edit>Select>Objects and define diagonal of a selection rectangle by clicking and dragging the mouse.
When mouse is released the application processes the selection event and names of objects are displayed in the list
See also: Sample List.
|