rbd:rectangle
List of: Scheme Extensions
Subjects: Rubberbanding
Contents: Graphic Interaction

Action: Creates a rectangle rubberband driver and, optionally, makes it active.

Filename: gi/gi_scm/rb_scm.cxx

Syntax: (rbd:rectangle activate [base=position 0 0 0])

Arg Types: activate boolean

base position

Returns: rbd-driver

Description: The argument base specifies a starting corner position of the rectangle. If base is not specified, the default start position is (0, 0, 0). If activate is #t, this extension automatically adds the new driver to the list of active drivers; otherwise, this extension creates the driver list and returns it.


The rectangle rubberband driver displays a white rectangle with one corner anchored at the base position and the other corner following the position of the cursor. The rectangle is in a plane parallel to the xy plane of the active WCS.


The moving end of the rubberband line is located on the rubberbanding projection plane. Mouse positions are projected onto this plane during rubberbanding as a result of setting the hook procedure,rb-position-hook. If this hook procedure is set to the empty list (default), then the projection plane is the xy plane of the active coordinate system.

Example: ; rbd:rectangle

; Define the first corner of the rectangle.

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

; Using the left mouse button, select a position

; in the active view on the screen.

;; start

; Create a rectangle rubberband driver.

(rbd:rectangle #t start)

;; #[rbd-driver 401b1df0]

; Define the second corner of the rectangle.

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

; Using the left mouse button, select a

; diagonal position in the active view.

;; 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)

;; (#[entity 3 1] #[entity 4 1] #[entity 5 1]

;; #[entity 6 1])

; Turn off rbd.

(rbd:remove-type rbd:rectangle?)

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