grid:set-snapping
List of: Scheme Extensions
Subjects: Grids, Picking
Contents: Graphic Interaction

Action: Sets grid snapping on or off.

Filename: gi/gi_scm/grid_scm.cxx

APIs: api_gi_activate_grid_snap

Syntax: (grid:set-snapping on-off)

Arg Types: on-off boolean

Returns: unspecified

Description: When grid snapping is on, positions computed by a pick position snap to the nearest grid point. off deactivates grid snapping; the default is off.

Example: ; grid:set-snapping

; Turn the grid on.

(grid:set-display #t)

;; ()

; Enable snapping of pick positions to the

; nearest grid point.

(grid:set-snapping #t)

;; ()

; Define the first corner of a rectangle.

(define start (pick:position (read-event)))

;; start

; Create a rectangle rubberband driver.

(rbd:rectangle #t start)

;; #[rbd-driver 401b1df0]

; Define the second corner of a rectangle.

(define end (pick:position (read-event)))

;; end

; Define the rectangle.

(define rectangle


(lambda (start end)



(let ((x1 (position:x start))




(x2 (position:x end))




(y1 (position:y start))




(y2 (position:y end))




(z1 (position:z start))




(z2 (position:z end)))


(list (edge:linear start end))


(let ((corner1 (position x2 y1 z2))



(corner2 (position x1 y2 z1)))


(list (edge:linear start corner1)



(edge:linear corner1 end)



(edge:linear end corner2)



(edge:linear corner2 start))))))

;; rectangle

; Draw the rectangle.

(rectangle start end)

; Draw the diagonal.

(define linear (edge:linear start end))

;; linear

; Turn off the rubberband driver.

(rbd:remove-type rbd:rectangle?)

;; ()
PDF/GI/02SCG.PDF
HTM/DATA/GI/GI/02SCG/0011.HTM