Object snap Home

Setting object snap on/off:

lcPropPutBool ( hLcWnd, LC_PROP_WND_OSNAP, true );
lcPropPutBool ( hLcWnd, LC_PROP_WND_OSNAP, false );

Setting object snap mode:

lcPropPutInt ( hLcWnd, LC_PROP_WND_OSNAP, Value );

where the Value parameter is a combination of the following constants:

Constant Object snap mode
LC_OSNAP_NODE to a Point object, dimension definition point, or dimension text origin.
LC_OSNAP_ENDPOINT to the closest endpoint of an Arc, Elliptical Arc, Line, Multiline, Polyline segment, Ray
LC_OSNAP_MIDPOINT to the midpoint of an arc, ellipse, elliptical arc, line, multiline, polyline segment, region, solid, spline, or xline.
LC_OSNAP_CENTER to the center of an arc, circle, ellipse, or elliptical arc.
LC_OSNAP_NEAREST to the nearest point on an arc, circle, ellipse, elliptical arc, line, multiline, point, polyline, ray, spline, or xline
LC_OSNAP_INTER to the intersection of an arc, circle, ellipse, elliptical arc, line, multiline, polyline, ray, region, spline, or xline
LC_OSNAP_PERPEND to a point perpendicular to an arc, circle, ellipse, elliptical arc, line, multiline, polyline, ray, region, solid, spline, or xline
LC_OSNAP_TANGENT to the tangent of an arc, circle, ellipse, elliptical arc, or spline
LC_OSNAP_QUADRANT to a quadrant point of an arc, circle, ellipse, or elliptical arc
LC_OSNAP_INSERT to the insertion point of an attribute, a block, a shape, or text

No combination constants
LC_OSNAP_NULL No object snap
LC_OSNAP_ALL All modes

Global properties for object snapping:

Property Type Access Meaning
LC_PROP_G_OSNAP_MARK bool RW Display object snap marker
LC_PROP_G_OSNAP_APER bool RW Display object snap aperture box
LC_PROP_G_OSNAP_MARKSIZE int RW Half-size of marker indicating snap point, pixels (1-15)
LC_PROP_G_OSNAP_APERSIZE int RW Half-size of square around cursor, used for snap, pixels (1-15)
LC_PROP_G_OSNAP_MARKCOLOR int RW Color of object snap marker (COLORREF)

Layer properties for object snapping:

Property Type Access Meaning
LC_PROP_LAYER_OSNAP bool RW Enable object snap for entities of the layer


Commands:

Command Meaning
LC_CMD_OSNAP Calls dialog "Object Snap"
LC_CMD_SW_OSNAP Toggles "Object Snap" mode


Object snap menu is called by <Shift> + <Right click>
In order to enable/disable this menu use LC_PROP_WND_OSNAPMENU property.


Code sample:
  int OSnap;
  OSnap = LC_OSNAP_ENDPOINT | LC_OSNAP_MIDPOINT | LC_OSNAP_CENTER;
  lcPropPutInt( hLcWnd, LC_PROP_WND_OSNAP, OSnap );
  lcPropPutBool( hLcWnd, LC_PROP_WND_OSNAP, true );