Measurements
Measurement mode of DG Kernel views allows
adding items, which display distances between points, coordinates of a selected
point and angles. A measurement can also be modified programmatically to display
a single line of text so that it will act as a text label attached to the
specified surface.
To enter the measurement mode, make sure the view has focus (click into
the window) and press 'm' key. The measurement mode has several sub modes
and a "delete all" command. The component exits the measurement mode
automatically when the current operation is either completed or interrupted.
The Advanced > Measurements > Add context menu (right mouse click) options offer
a user interface for entering the mode.
DG Kernel components have two styles of measurements: Persistent measurements
and Transient (default) measurements
Transient measurements disappear once the measurement mode is exited. They can be
used to quickly check distances and avoid adding extra items obscuring the scene
Transient measurements style (default) can be re-activated programmatically by setting the
MeasurementsStyle property of
DG Kernel Context to 1.
Persistent
measurements are part of the model. Once added to the scene they persist during
viewing manipulations: rotations etc
To switch between the modes at runtime got to Advanced > Measurements > Style in
context menu (right mouse click)
Persistent measurements style can also be activated programmatically by
setting the MeasurementsStyle property of
DG Kernel Context to 0.
See Persistent Measurements topic for
more details
When MeasurementsShowOnMouseMove property of
DG Kernel Context is set to
true (false is the default) the component displays distance between the first
point of the measurement and the current position of the mouse during movement
from the first to the second point. The distance is measured along plane
parallel to plane of the screen and recalculated precisely after the second
point has been selected.
To measure angle in the screen plane between a line and horizontal direction
select Advanced > Measurements > Add > Angle in the context menu and click two
points on the screen to define a line.
To measure angle in the screen plane with arbitrary direction hold Control key
while clicking Advanced > Measurements > Add > Angle option in the menu.
This action will open Angle Measurement Options dialogue. Make sure the "View
Plane" option is selected and clear the "Horizontal" check box. The
software will use the next two clicks to define the direction. The third click
will show the angle.
To measure angle on a surface hold Control key
while clicking Advanced > Measurements > Add > Angle option in context menu.
In the Angle Measurement Options dialogue select "Surface" option and click OK. The
next two clicks will define a line between two points on surface of object(s). The third click
will show angle between the line and line between first and third points. During
mouse movement the operation displays angle in screen plane. The final angle
shown after the third click is calculated for the points picked on surface. When
the mouse is clicked outside any object the result should be considered
unreliable.
To make the above options programmatically query context of angle
measurements via: DG Kernel > GetView() > IContext_DG >
GetParam(0) >
object (or IUnknown) > IContext_DG. Properties of the returned
context are:
Property |
Description |
Type |
Parameter ID |
Default |
ShowDialog |
Show Angle Measurement Options dialogue on Advanced > Measurements
> Add > Angle (+Ctrl) |
Boolean |
0 |
True |
AngleOnSurface |
Measure angle in surface of the object under the mouse |
Boolean |
1 |
True |
DefineHorizon |
Define a line to measure the angle against with the first two
clicks |
Boolean |
2 |
True |
Max90degrees |
If false the angle shown will always be measured against the
positive x axis or the defined direction and can be any number in (-180, 180]
range |
Boolean |
3 |
True |
When ShowDialog is set to false the dialogue
will not be displayed. If the property is true, other properties will be
displayed in the dialogue for modification.
See OnFormLoad() method of DIView sample (C#) or
CLightDlg::InitBackground() function of Light sample (C++) for an example.
|