Autodesk.AutoCAD.DatabaseServices Namespace > Entity Class > Entity Methods > GetObjectSnapPoints Method > GetObjectSnapPoints(ObjectSnapModes, int, Point3d, Point3d, Matrix3d, Point3dCollection, IntegerCollection) Method
Entity.GetObjectSnapPoints(ObjectSnapModes, int, Point3d, Point3d, Matrix3d, Point3dCollection, IntegerCollection) Method   
Description

 

This function must use the material provided in snapMode, gsSelectionMark, pickPoint, lastPoint, and viewTransform to determine all appropriate osnap points for the entity. It must then append all such osnap points to the snapPoints array. 

The snapPoints array is passed to all entities involved in the osnap operation, so it's possible that the array will already have entries in it when passed in. For this reason, it's very important that points be appended to the snapPoints array instead of assigning to any existing elements. 

The snapMode argument indicates which osnap mode is involved in the operation. Not all modes are applicable to all entity types (for example, ObjectSnapModes.ModeIns is not applicable to a line). The possible values for this argument are: 

 

ObjectSnapModes.ModeEnd 
Find the endpoint on the entity that is nearest to the pickPoint
ObjectSnapModes.ModeMid 
Find the midpoint (of any line, arc, etc., subentity) that is nearest to the pickPoint 
ObjectSnapModes.ModeCenter  
Find the center point (of any circle or arc subentity) that is nearest to the pickPoint 
ObjectSnapModes.ModeNode 
Find the node point (for example, dimension node points) that is nearest to the pickPoint 
ObjectSnapModes.ModeQuad  
Find the quad point (traditionally the four quadrant points on a circle) that's nearest to pickPoint 
ObjectSnapModes.ModeIns  
Find the intersection point of the entity and a line perpendicular to the entity that passes through lastPoint 
ObjectSnapModes.ModePerpindicular 
Find the intersection point of the entity and a line perpendicular to the entity that passes through lastPoint 
ObjectSnapModes.ModeTangent  
Find a point on the entity where a line that passes through lastPoint will be tangent to the entity 
ObjectSnapModes.ModeNear  
Find the point on the entity that's nearest to pickPoint. You decide what 'nearest' means 

 

The gsSelectionMark argument contains the GS marker of the subentity that's involved in the osnap operation. If the entity hasn't set any GS markers, then this is the default GS marker value of 0. The GS marker is provided to allow narrowing down the osnap point(s) search parameter if desired. 

The pickPoint argument provides the point (in WCS coordinates) that started this osnap operation. 

The lastPoint argument provides the point picked just prior to the pickPoint point. This point is used when determining perpendicular and tangent osnap values. 

The viewTransform argument provides a transformation matrix to transform from WCS (World Coordinate System) to DCS (display coordinate system). 

The display coordinate system is oriented such that the positive Z axis is coming out of the display screen towards the user, the positive X axis is horizontally from left to right on screen, and the positive Y axis is vertically upward on screen. 

So, if the current viewpoint is at (1,0,0) (the viewer is always looking towards (0,0,0)) then the viewTransform matrix would be:

0 1 0 0
0 0 1 0
1 0 0 0
0 0 0 1

In this matrix the last row and the last column are not used. Notice also that the third row is the DCS Z axis in WCS coordinates (which is the WCS version of the AutoCAD VIEWPOINT system variable). 

This transformation matrix is provided to allow you to determine positions of various points in the current view. This is most useful for the ObjectSnapModes.ModeNear mode where "nearest" may depend on the viewpoint. 

The snapPoints argument is the array to append the resulting osnap points to. You may append zero or more points to the array. 

This same array is passed to all entities involved in the osnap operation. When all entities have been queried, AutoCAD determines which point in the array is most appropriate for the desired osnap mode. So, this function does not need to narrow the search down to one point.

Visual Basic
Public Function GetObjectSnapPoints(
    snapMode As ObjectSnapModes, 
    gsSelectionMark As Integer, 
    pickPoint As Point3d, 
    lastPoint As Point3d, 
    viewTransform As Matrix3d, 
    snapPoints As Point3dCollection, 
    geometryIds As IntegerCollection
) As void
C#
public void GetObjectSnapPoints(
    ObjectSnapModes snapMode, 
    int gsSelectionMark, 
    Point3d pickPoint, 
    Point3d lastPoint, 
    Matrix3d viewTransform, 
    Point3dCollection snapPoints, 
    IntegerCollection geometryIds
);
Parameters
Parameters 
Description 
ObjectSnapModes snapMode 
Input osnap mode being requested 
int gsSelectionMark 
Input GS marker of the subentity involved in the object snap operation 
Point3d pickPoint 
Input point (in WCS coordinates) picked during the object snap operation 
Point3d lastPoint 
Input point (in WCS coordinates) selected just before pickPoint 
Matrix3d viewTransform 
Input transformation matrix to transform from WCS to DCS 
Point3dCollection snapPoints 
Input pre-existing array to append osnap points to (may already contain points); output with object snap points appended 
IntegerCollection geometryIds 
Not in use 
Links
   Comments?