DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Collapse ModelsModels
Collapse DG Kernel ControlsDG Kernel Controls
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Collapse General GeometryGeneral Geometry
Collapse ModelModel
Collapse ViewView
Collapse General ComputingGeneral Computing
Collapse Samples and TutorialsSamples and Tutorials
Collapse GraphicsGraphics
Collapse Math ObjectsMath Objects
Collapse DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation Links Go to DGKC docs Search Documentation


IPick Interface

GetItemAt
GetItemAt3D
GetItemAtDepth
GetSurfacePointAt

IPick interface gives programmatic access to 3D selection The mechanism provided by this interface is different from CurrentObjectChanged event raised in Modify Mode.

IPick can be queried from the IView interface

Query path: DG Kernel > GetView > IView > IPick

See also Pick Sample, Interface List


HRESULT GetItemAt( int xWnd, int yWnd, IItem** item )

Parameters

xWnd, int yWnd - [in] Window coordinates in pixels measured from the top left corner

 item - [out] The returned IItem interface.

Remarks:

The method detects whether there is an object at the specified window point and returns IItem interface implemented by the object. If there are several objects at the point the top one (the visible one) is returned.  See also the Advanced note below, which applies to this method too.


HRESULT GetItemAt3D( int xWnd, int yWnd, DIPoint* point, IItem** item )

xWnd, int yWnd -[in] Window coordinates in pixels measured from the top left corner.

point - [out] Returned global coordinates of 3D point on surface of the object at the specified window point. Coordinates of the point are random if there is no object at the window location.

 item - [out] The returned IItem interface. The item reference can be NULL if the return is not required. 

Remarks:

The method is an enhancement of the GetItemAt above. It detects whether there is an object at the specified window point and returns IItem interface implemented by the object. If there are several objects at the point the top one (the visible one) is returned. 

The point is the 3D point on surface of the object, if there is one. It is the intersection point of surface of the object with 3D line orthogonal to the screen at the specified window point. Coordinates of the point are relative to the global 3D axes.

Advanced: As the method uses relatively complex computations for high frequency programmatic usage it is recommended to experiment with graphic-only algorithm. To change the algorithm set the PrecisePointPicking property in context of the DG Kernel component to false. In many situations the graphic-only algorithm determines the point on the surface with acceptable precision. An exception is the case when surface approximation is very rough (See Geometric Resolution) or the object consist only of few triangular simplexes. In the latter case z-coordinate of point relative to the Viewing Frame is the maximum among all vertexes of the simplex. 


HRESULT GetItemAtDepth( int xWnd, int yWnd, float* minZ, float* maxZ, IItem** item )

Parameters

xWnd, int yWnd - [in] Window coordinates in pixels measured from the top left corner.

 minZ, maxZ - [out] Minimum and maximum of z coordinates in Viewing Frame among all interentitys of 3D line orthogonal to the screen at the specified window point with the picked object

item - [out] The returned IItem interface. The item reference can be NULL if the return is not required. 

Remarks:

The method is an enhancement of the GetItemAt above. It detects whether there is an object at the specified window point and returns IItem interface implemented by the object. If there are several objects at the point the top one (the visible one) is returned. 

When the selected object is a closed surface, the 3D line orthogonal to the screen at the specified point intersects it at least twice. The method returns minimum and maximum of z coordinates in Viewing Frame for those intersections.

See also note at the end of GetItemAt3D.


HRESULT GetSurfacePointAt( int xWnd, int yWnd, ISurfacePointKC** surfPoint )

Parameters

xWnd, int yWnd - [in] Window coordinates in pixels measured from the top left corner.

 surfPoint - [out,retval] The returned surface point

Remarks:

The method is an enhancement of the GetItemAt above. It detects whether there is an object at the specified window point and returns ISurfacePointKC interface implemented by the object. Use ISurfacePointKC.GetItem() > ISection to obtain information about the object. Query ISurfacePointKC > IMeshPointKC for objects with meshed surface to obtain extended information about simplex and other mesh elements under the mouse.

Unless there was an error, the method always returns a non-null surface point. When there is no object at the screen location ISurfacePointKC.GetPoint() returns the correspondent point at x and y plane of eye frame and ISurfacePointKC.GetItem() returns null