All Cadcorp SIS API Methods

Snap2D Method

Description

Simulates a 2D snap making snapped item current and returning the snapped position.

Syntax

Visual Basic
Public Function Snap2D( _
   ByVal x As Double, _
   ByVal y As Double, _
   ByVal r As Double, _
   ByVal bEditOnly As Long, _
   ByVal codes As String, _
   ByVal filter As String, _
   ByVal locus As String _
) As String

Parameters

x
The x coordinate of the position from which to snap. Item geometries with any Z values will be considered.
 
y
The y coordinate of the position from which to snap. Item geometries with any Z values will be considered.
 
r
The approximate radius to search within.
 
bEditOnly
Should SIS only consider editable items?
 
codes
The types of geometry you wish to snap to. You can supply a single letter, or a list of letters. SIS will find the closest matching geometry. Some snap-codes take priority over others. For example, if you specify "LV" and a vertex is only slightly further away than a line, then SIS will snap to the vertex.

A    Find smallest area containing position.
B    Snap to box-text justification point.
C    Snap to centre of curvature of closest line.
E    Snap to nearest end of closest line.
H    Snap to hook position, or origin, of item containing closest linework.
L    Snap to closest linework.
M    Snap to middle of closest line segment.
P    Snap to closest point.
R    Snap to corner of closest raster pixel that contrasts with its neighbour.
V    Snap to closest line vertex.
X    Snap to closest linear intersection.
These snap-codes apply to geometry, not item classes. For example, the L snap-code will find the closest linear geometry, which may be part of a LineString item, or the boundary of a Polygon item. Similarly, the A snap-code will find any area-filling item (e.g. TopoPolygon).
 
filter
Optionally specifies a named Filter which Items must pass to be considered for snapping.
 
locus
Optionally specifies a named Spatial Filter which Items must pass to be considered for snapping.

Return Type

A comma-delimited string containing the x, y and z co-ordinates of the snapped position within the current axes. Use SplitPos to get the x, y and z values themselves.

Remarks

Available: GEO D OD OM SISpy

Group:

Example

sis.CreatePropertyFilter("LandParcels", "Exists('ParcelRef$')") sPos = Snap2D (582622, 109632, 0.5, False, "AL", "LandParcels"", "")

Returns a comma-delimited string of the closest position on a LineString item or polygon restricting the search to a 0.5 metre radius. Only items which hold a ParcelRef$ attribute will be considered in the search.

NFound = Snap2D(x, y, 5, 0, "LVP", "", "")

Returns the coordinates of the closest LineString item, point or vertex within 5 metres of the coordinates x, y.