Scheme Extensions Aa thru Uz |
|
|
Technical Article |
Scheme is a public domain programming language, based on the LISP language,
that uses an interpreter to run commands. ACIS provides extensions (written
in C++) to the native Scheme language that can be used by an application
to interact with ACIS through its Scheme Interpreter. The C++ source files
for ACIS Scheme extensions are provided with the product. Spatial's Scheme
based demonstration application, Scheme ACIS Interface Driver Extension
(Scheme AIDE), also uses these Scheme extensions and the Scheme Interpreter.
|
on-off | boolean |
; dl:dynamic-silhouette-display ; Turn on the automatic recomputation ; of display silhouettes of solids. (dl:dynamic-silhouette-display #t) ;; #t ; Turn off the automatic recomputation ; of display silhouettes of solids. (dl:dynamic-silhouette-display #f) ;; #t |
[Top]
None |
; env:views ; Create a new view. (define view (view:dl)) ;; view (define view2 (view:dl)) ;; view2 view ;; #[view 1076066832] view2 ;; #[view 1076071408] ; Get a list of all views. (define viewlist (env:views)) ;; viewlist ; (#[view 1076016872] #[view 1073761464] ; #[view 1076066832] #[view 1076071408]) ; This assumes the two views created in this example ; and two views created by manual.scm. One of the ; views from manual.scm is an interleaf view that ; you do not see. |
[Top]
driver | rbd-driver | (rbd-driver ...) |
; rbd:add ; Create and activate a line rubberband anchored at ; position 0 0 0 (define rubber1 (rbd:line #t (position 0 0 0))) ;; rubber1 ; Create a line rubberband anchored at ; position 20 10 0, but do not activate it. (define rubber2 (rbd:line #f (position 20 10 0))) ;; rubber2 ; Add second rubberband driver to the active list. (rbd:add rubber2) ;; (#[rbd-driver 401b1018] #[rbd-driver 401b1026]) ; Get the list of active rubberband drivers. (rbd:drivers) ;; (#[rbd-driver 401b1018] #[rbd-driver 401b1026]) ; Clear the active driver list. (rbd:clear #f) ;; () (rbd:clear #f) ;; () |
[Top]
flag-all | boolean |
; rbd:clear ; Add a rubberband driver to the active list. (rbd:add (rbd:rectangle #f (position 0 0 0))) ;; (#[rbd-driver 4022a2f8]) ; Add a rubberband driver to the active list. (rbd:add (rbd:line #f (position 10 20 30))) ;; (#[rbd-driver 4022a3c0] #[rbd-driver 4022a2f8]) ; Clear the last defined rubberbanding procedure. (rbd:clear #f) ;; () ; Clear the first defined rubberbanding procedure. (rbd:clear #f) ;; () |
[Top]
activate | boolean |
entity-list | entity | (entity ...) |
base | position |
; rbd:drag ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 10 20 15))) ;; block1 ; Enable rubberband dragging. (rbd:drag #t block1) ;; #[rbd-driver 401ca0a8] ; Clear the first defined rubberbanding procedure. (rbd:clear #f) ;; () ; Double-click entity dragging example follows. ; Create a user interface error dialog box. (ui:error-dialog "Click on block1 entity.") ; Click on block entity. (define evt (read-event)) ;; evt ; Get entity portion of event. (define ent (pick:entity evt)) ;; ent ; Test to see if object is an entity. ; Get original location of entity/event. (define pos1 (pick:position evt)) ;; pos1 ; Test to see if object is entity. ; Move mouse to new position. Image should follow. ; Drag entity to new location. ; Click on where entity is to go. (if (entity? ent) (begin (rbd:drag #t ent pos1) (ui:error-dialog "Click on Destination for block1.") (define pos2 (pick:position (read-event))) (rbd:remove-type rbd:drag?) (entity:transform ent (transform:translation (gvector:from-to pos1 pos2)))) (ui:error-dialog "Object selected is not entity.")) ;; #[entity 2 1] ; Move entity back to where it originally was. (if (entity? ent) (begin (entity:transform ent (transform:translation (gvector:from-to pos2 pos1)))) (ui:error-dialog "Object selected is not entity.")) ;; #[entity 2 1] |
[Top]
object | scheme-object |
Description
This extension returns #t if a drag rubberband driver in in the active
driver list (for example, a list at top of the driver stack); otherwise, it returns
#f. Used primarily with the rbd:remove-type
extensions.
; rbd:drag? ; Determine if the Boolean is a rbd-drag driver. (rbd:drag? #t) ;; #f ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 10 10 10))) ;; block1 ; Determine if the rbd-drag driver is actually ; a rbd-drag driver. (rbd:drag? (rbd:drag #t block1 (position 1 2 3))) ;; #t ; Determine if the rbd-line driver is a ; rbd-drag driver. (rbd:drag? (rbd:line #t (position 1 2 3))) ;; #f ; Stop the dragging process. (rbd:clear #f) ;; () (rbd:clear #f) ;; () |
[Top]
depth | integer |
Description
This extension returns a list of rubberband drivers from a stack of lists
of rbd-drivers.
; rbd:drivers ; Create a line rubberband driver. (define rubber1 (rbd:line #t (position 0 0 0))) ;; rubber1 (define rubber2 (rbd:line #f (position 0 0 0))) ;; rubber2 ; Add second rbd to active list. (rbd:add rubber2) ;; (#[rbd-driver 402274e8] #[rbd-driver 402273f0]) ; Push the combined list on the stack and make ; first rbd active at top of stack. (rbd:push rubber1) ;; (#[rbd-driver 402273f0]) ; Push the first on the stack and make ; second rbd active at top of stack. (rbd:push rubber2) ;; (#[rbd-driver 402274e8]) ; Get a list of rubberband-drivers from the stack ; of drivers. (rbd:drivers 1) ;; (#[rbd-driver 402273f0]) (rbd:drivers 2) ;; (#[rbd-driver 402274e8] #[rbd-driver 402273f0]) (rbd:drivers) ;; (#[rbd-driver 402274e8]) ; Pop the top of a stack of rubberband-driver lists. (rbd:pop) ;; (#[rbd-driver 402274e8]) (rbd:pop) ;; (#[rbd-driver 402273f0]) (rbd:drivers) ;; (#[rbd-driver 402274e8] #[rbd-driver 402273f0]) (rbd:clear) ;; () |
[Top]
activate | boolean |
base | position |
; rbd:generic ; Create a generic rubberband driver. (rbd:generic #t (position 3 -5 20)) ;; #[rbd-driver 401b1018] ; The system activates the rubberband driver. ; The report of mouse information is displayed ; in the command window. ; Clear this rubberbander from the active list (rbd:clear #t) ;; () |
[Top]
object | scheme-object |
Description
This extension returns #t if a generic rubberband driver is in the list
of active rubberband drivers (for example,the list at the top of the stack);
otherwise, it returns #f.
; rbd:generic? ; Determine if the Boolean is a rbd-generic driver. (rbd:generic? #t) ;; #f ; Determine if the rbd-generic driver is actually ; an rbd-generic driver. (rbd:generic? (rbd:generic #t (position 1 2 3))) ;; #t ; Determine if the rbd-line driver is an ; rbd-generic driver. (rbd:generic? (rbd:line #t (position 1 2 3))) ;; #f ; Clear this rubberbander from the active list (rbd:clear #t) ;; () |
[Top]
activate | boolean |
base | position |
; rbd:line ; Define the position of the start of line. (define start (pick:position (read-event))) ;; start ; Create a line rubberband driver. (rbd:line #t start) ;; #[rbd-driver 401b1df0] ; Define the position of the end of line. (define end (pick:position (read-event))) ;; end ; Define the line. (define line (edge:linear start end)) ;; line ; Turn off rbd. (rbd:remove-type rbd:line?) ;; () |
[Top]
object | scheme-object |
Description
This extension returns #t if a line rubberband driver is in the list of
active rubberband drivers (for example, the list at the top of the stack); otherwise,
it returns #f.
; rbd:line? ; Determine if the Boolean is an rbd-line driver. (rbd:line? #t) ;; #f ; Define the position of the start of line. (define start (pick:position (read-event))) ;; start ; Create a line rubberband driver. (rbd:line #t start) ;; #[rbd-driver 401b1df0] ; Define the position of the end of line. (define end (pick:position (read-event))) ;; end ; Define the line. (define line (edge:linear start end)) ;; line ; Turn off rbd. (rbd:remove-type rbd:drag?) ;; (#[rbd-driver 401e7530]) (rbd:remove-type rbd:line?) ;; () |
[Top]
None |
Description
This extension deactivates the current rubberband driver list by removing
it from the top of the stack. If there was a prior list that had been
pushed onto the stack, it becomes the active rubberband driver list. If
the stack was empty, this returns #f. Returning #f is not the same as
returning an empty list. #f indicates the stack is empty. An empty list
indicates that the top list on the stack had no active drivers; there
could be other drivers still in the rubberband stack.
; rbd:pop ; Create a line rubberband driver. (define rubber1 (rbd:line #t (position 0 0 0))) ;; rubber1 (define rubber2 (rbd:line #f (position 10 20 0))) ;; rubber2 ; Add second rbd to active list. (rbd:add rubber2) ;; (#[rbd-driver 40227478] #[rbd-driver 40227380]) ; Push the combined list on the stack and make ; the first rbd active at top of stack. (rbd:push rubber1) ;; (#[rbd-driver 40227380]) ; Push the first on the stack and make ; the second rbd active at top of stack. (rbd:push rubber2) ;; (#[rbd-driver 40227478]) ; Get a list of rubberband-drivers from the stack of ; drivers. ; Lowest in the stack (rbd:drivers 2) ;; (#[rbd-driver 40227478] #[rbd-driver 40227380]) ; Middle of the stack. (rbd:drivers 1) ;; (#[rbd-driver 40227380]) ; Top of the stack. (rbd:drivers) ;; (#[rbd-driver 40227478]) ; Pop the top of a stack of rubberband-driver lists. (rbd:pop) ;; (#[rbd-driver 40227478]) (rbd:pop) ;; (#[rbd-driver 40227380]) (rbd:drivers) ;; (#[rbd-driver 40227478] #[rbd-driver 40227380]) (rbd:clear) ;; () |
[Top]
driver | rbd-driver | (rbd-driver ...) |
Description
This extension deactivates the current rubberband driver list by pushing
it down into the stack. If an optional rubberband driver list was specified,
it becomes the active driver list. If no optional rubberband driver list
is specified, then the active rubberband driver is an empty list.
The list of drivers pushed onto the stack can be retrieved and reactivated
by using rbd:pop to pop the current driver
list off of the stack.
; rbd:push ; Create a line rubberband driver. (define rubber1 (rbd:line #t (position 0 0 0))) ;; rubber1 (define rubber2 (rbd:line #f (position 10 20 0))) ;; rubber2 ; Add second rbd to active list. (rbd:add rubber2) ;; (#[rbd-driver 402274e8] #[rbd-driver 402273f0]) ; Push the combined list on the stack and make ; the first rbd active at top of stack. (rbd:push rubber1) ;; (#[rbd-driver 402273f0]) ; Push the first on the stack and make the ; second rbd active at top of stack. (rbd:push rubber2) ;; (#[rbd-driver 402274e8]) ; Get a list of rubberband-drivers from the stack ; of drivers. ; Lowest in the stack. (rbd:drivers 2) ;; (#[rbd-driver 402274e8] #[rbd-driver 402273f0]) ; Middle of the stack. (rbd:drivers 1) ;; (#[rbd-driver 402273f0]) ; Top of the stack. (rbd:drivers) ;; (#[rbd-driver 402274e8]) ; Pop the top of a stack of rubberband-driver lists. (rbd:pop) ;; (#[rbd-driver 402274e8]) (rbd:pop) ;; (#[rbd-driver 402273f0]) (rbd:drivers) ;; (#[rbd-driver 402274e8] #[rbd-driver 402273f0]) (rbd:clear) ;; () |
[Top]
activate | boolean |
base | position |
; 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?) ;; () |
[Top]
object | scheme-object |
Description
This extension returns #t if there is a rectangle rubberband driver in
the active driver list (for example, list at the top of the rubberband stack).
Otherwise, this returns #f.
; rbd:rectangle ; Determine if the Boolean is a rbd-rectangle driver. (rbd:rectangle? #t) ;; #f ; Determine if the rbd-rectangle driver is actually ; a rbd-rectangle driver. (rbd:rectangle? (rbd:rectangle #t (position 0 30 0))) ;; #t ; Determine if the rbd-line driver is a ; rbd-rectangle driver. (rbd:rectangle? (rbd:line #t (position 1 2 3))) ;; #f ; Clear the drivers. (rbd:clear #f) ;; () (rbd:clear #f) ;; () |
[Top]
driver | rbd-driver | (rbd-driver ...) |
Description
This extension removes the most recently added driver from the list of
active rubberband drivers (for example, the list at the top of a stack). This
extension returns the list of active drivers.
; rbd:remove ; Remove a specific driver from the list of ; active drivers. ; Define a rbd-line driver. (define rb-driver (rbd:line #t (position 10 5 0))) ;; rb-driver ; Define a rectangle. (define rectangle (rbd:rectangle #t)) ;; rectangle (rbd:drivers) ;; (#[rbd-driver 402276a0] #[rbd-driver 40227608]) ; Remove the rbd-line driver from the active list. (rbd:remove rb-driver) ;; (#[rbd-driver 402276a0]) (rbd:drivers) ;; (#[rbd-driver 402276a0]) ; Clear the last driver. (rbd:clear #f) ;; () |
[Top]
type-predicate | scheme-procedure |
Description
This extension removes the most recently added rubberband driver(s) matching
the given type-predicate from the list of active rubberband drivers.
; rbd:remove-type ; Create a line rubberband driver. (rbd:line #t (position 10 20 0)) ;; #[rbd-driver 40228d88] ; Create a rectangular rubberband driver. (rbd:rectangle #t (position 0 30 0)) ;; #[rbd-driver 40228eb8] ; Create another line rubberband driver. (rbd:line #t (position 20 5 0)) ;; #[rbd-driver 40228fe0] ; List the rubberband drivers. (rbd:drivers) ;; (#[rbd-driver 40228fe0] #[rbd-driver 40228eb8] ;; #[rbd-driver 40228d88]) ; Remove the two line rubberband drivers. (rbd:remove-type rbd:line?) ;; (#[rbd-driver 40228eb8] #[rbd-driver 40228d88]) ; Remove the other rubberbander. (rbd:clear #f) ;; () |
[Top]
activate | boolean |
hooks | vector |
locals | vector |
The argument types for the hooks are:
The example below shows the hook procedure definition for a user-defined rubberband driver. It creates the seven-element Scheme vector, the-rb-hooks, whose procedures do nothing more than print out a simple message when an event occurs. Developers can replace these messages with more complex code to do application-specific tasks.
When the vector has been defined, a Scheme rubberband driver is created by calling rbd:scheme, using the hooks vector. The #f tells rbd:scheme to create the driver but not activate it. The vector, locals, stores data specific to this particular driver. These data can be any Scheme objects and tailors the operation of a particular driver.
Finally, the rbd:push command pushes another other active rubberband driver list onto the stack and then makes this driver active at the top of the stack of active drivers. The rbd:pop command removes it from the top of the stack, deactivates it, and makes the pushed rubberband driver list on the stack the active driver. The read-event calls are a simple way to control the operation of the example.
The start position (when the cursor enters the window) is saved by the-start-hook
in the driver's local variable vector(0). The end position is stored and
modified by the-update-hook in the driver's local variable vector(1).
These positions are printed when the example exits, to illustrate the
use of local data.
Arguments
hooks
specifies a Scheme vector consisting of 7 elements. The elements are Scheme
procedures.
locals
specifies a vector of user-defined objects.
If
activate is #t, this extension
automatically adds the new driver to the list of active drivers; otherwise,
this extension creates and returns it.
; rbd:scheme ; Create a vector to hold 7 elements. ; Define the rb hooks. This is called once when ; the driver is activated. It can be used to set ; globals or the elements in the locals vector. (define the-rb-hooks (make-vector 7)) ;; the-rb-hooks ; Define the init hook. This is Called when the ; driver is activated and when mouse enters a window. (define the-init-hook (lambda (self) (display "rubberband driver: INIT.\n"))) ;; the-init-hook ; Define the start hook. This is Called when the ; mouse moves within a window. (define the-start-hook (lambda (self pick-event) (display "rubberband driver: START.\n") (rbd:scheme-set-local self 0 (pick:position pick-event)) (rbd:scheme-get-position self pick-event))) ;; the-start-hook ; Define the update hook. this is called when the ; mouse leaves a window and when the driver is ; deactivated. (define the-update-hook (lambda (self pick-event) (display "rubberband driver: UPDATE.\n") (rbd:scheme-set-local self 1 (pick:position pick-event)))) ;; the-update-hook ; Define the stop hook. This is called when a view ; receives a repaint event. (define the-stop-hook (lambda (self) (display "rubberband driver: STOP.\n"))) ;; the-stop-hook ; Define the repaint hook. This may be called by ; other hooks to map a pick-event to a position. (define the-repaint-hook (lambda (self view) (display "rubberband driver: REPAINT.\n"))) ;; the-repaint-hook ; Define the position hook. This is Called once when ; the driver is deactivated. (define the-position-hook (lambda (self pick-event) (display "rubberband driver: POSITION.\n") (display "position not changed\n"))) ;; the-position-hook ; Define the end hook. Non-scheme rbd drivers can use ; the global variable 'rb-position-hook', whereas, ; Scheme rbd drivers use that or the 'position ; hook'. (define the-end-hook (lambda (self) (display "rubberband driver: END.\n"))) ;; the-end-hook ; Initialize. (vector-set! the-rb-hooks 0 the-init-hook) ;; () (vector-set! the-rb-hooks 1 the-start-hook) ;; () (vector-set! the-rb-hooks 2 the-update-hook) ;; () (vector-set! the-rb-hooks 3 the-stop-hook) ;; () (vector-set! the-rb-hooks 4 the-repaint-hook) ;; () (vector-set! the-rb-hooks 5 the-position-hook) ;; () (vector-set! the-rb-hooks 6 the-end-hook) ;; () ; Start rubberbanding. ; Create and initialize some local variables. (define the-locals (make-vector 2)) ;; the-locals (vector-set! the-locals 0 (position 0 0 0)) ;; () (vector-set! the-locals 1 (position 0 0 0)) ;; () ; Create the Scheme rubberband driver. (define the-scm-rbd (rbd:scheme #f the-rb-hooks the-locals)) ;; the-scm-rbd ; Begin rubberbanding. (read-event) ; Using the mouse button, select a screen ; position. ;; #[pick-event 185 455 1 1075924776 0] ; Push the rubberband driver onto the stack. (rbd:push the-scm-rbd) ;; rubberband driver: INIT. ;; (#[rbd-driver 4021eb48]) (read-event) ;; rubberband driver: START. ;; rubberband driver: POSITION. ;; position not changed ;; rubberband driver: UPDATE. ;; ... ;; rubberband driver: UPDATE. ;; rubberband driver: STOP. ; Remove the driver from the stack. (rbd:pop) ;; rubberband driver: END. ;; (#[rbd-driver 4021eb48]) ; Display the results. (display "Start Position: ") (display (vector-ref the-locals 0)) (newline) ;; Start Position: ;; #[position 38.1656983627057 -92.3988426777293 0] (display "Stop Position: ") (display (vector-ref the-locals 1)) (newline) ;; Stop Position: ;; #[position 28.72230 -96.44886 -7.105e-15] (rbd:clear #f) ;; () |
[Top]
driver | rbd-driver |
index | integer |
Description
Scheme rubberbanders carry a vector of user-defined Scheme objects that
are used within their hook functions. This extension enables the values
in these objects to be obtained. This extension is used by a Scheme rubberband
driver to access the contents of its own "locals" vector.
; rbd:scheme-get-local ; Define a start or update hook procedure that gets ; the value of the fourth local variable in a ; rbd:scheme driver's locals vector. (lambda (self event) (rbd:scheme-get-local self 3)) ;; #[compound 1074571208] |
[Top]
driver | rbd-scheme-driver |
event | pick-event |
Description
Scheme rubberband drivers carry a vector of user-defined Scheme procedures.
One of these is intended for calculating positions from an input pick
event. This extension calls that procedure, passing a rbd-scheme-driver
and a pick-event. It returns the value of the get position hook; normally
this is a position, but it can be any scheme-object.
This extension is used by a Scheme rubberband driver to map a pick-event
to a 3D position. This is achieved by calling rbd:scheme-get-position
with the first argument as self.
; rbd:scheme-get-position ; Define an update or start hook that calls the local ; Get the position hook of an rbd-scheme driver. (lambda (self event) (rbd:scheme-get-position self event)) ;; #[compound 1074571496] |
[Top]
driver | rbd-driver |
index | integer |
object | scheme-object |
Description
Scheme rubberbanders carry a vector of user defined Scheme objects that
are used within their hook functions. This extension enables new values
to be set in these objects, and it returns the old value of the variable.
This extension is used by a Scheme rubberband driver to modify one of its
own procedures. This is achieved by calling rbd:scheme-set-local with
the first argument as self.
; rbd:scheme-set-local ; Set the value of a local variable in a ; Scheme rubberband driver. (lambda (self event) (rbd:scheme-set-local self 3 5)) ;; #[compound 1074571992] |
[Top]
object | scheme-object |
Description
This extension returns #t if a user-defined rubberband driver is in the
active list of rubberband drivers (for example, at the top of the stack); otherwise,
it returns #f.
; rbd:scheme? ; Determine if there is an active Scheme rbd-driver. (rbd:scheme? #t) ;; #f |
[Top]
event | pick-event |
Description
If the rubberbanded figure is currently not displayed, this extension calls
the rubberband driver's internal start-hook procedure for all rubberbanders
in the active list. If the rubberbanded figure is currently displayed,
this extension calls the rubberband driver's internal update-hook procedure
for all rubberbanders in the active list.
This extension is used in conjunction with rbd:pop
and rbd:push. It turns on the graphic portion
of the rubberband drivers after it had been suspended (in the case of
rbd:push and then
rbd:pop).
; rbd:start ; Send a rubberbanding start event. (rbd:start (read-event)) ; Using the mouse button, select a screen position. ;; #[pick-event 245 528 1 1075533160 0] |
[Top]
None |
Description
This extension calls the rubberband driver's internal stop-hook procedure
for all rubberbanders in the active list.
This extension is used in conjunction with rbd:pop
and rbd:push. It turns off the graphic
portion of the rubberband drivers so that (in the case of
rbd:push) it will not be confused with
the new driver being started.
; rbd:stop ; Send a rubberbanding stop event. (rbd:stop) ;; () |
[Top]
event | pick-event |
Description
This extension calls the rubberband driver's internal update-hook procedure
for all rubberbanders in the active list.
This extension is used in conjunction with rbd:pop
and rbd:push. It turns on the graphic portion
of the rubberband drivers after it had been suspended (in the case of
rbd:push and then
rbd:pop).
; rbd:update ; Send a rubberbanding update event. (rbd:update (read-event)) ;; #[pick-event 325 529 1 1075533160 0] |
[Top]
activate | boolean |
pe | pick-event |
type | string |
reverse | boolean |
Description
This extension rubber bands the view by moving the camera or moving the
object based on the mouse position.
; rbd:view ; Create an object to view the changes (define block1 (solid:block (position 0 0 0) (position 10 20 30))) ;; block1 ; Create a view rubber band driver for rotating a ; view. (rbd:view #t (read-event) "trackball") ;; #[rbd-driver 401b1df0] ; Click on a point in the view and move object ; Clear rubber band driver. (rbd:clear #f) ;; () ; A more detailed example from rotsph.scm. ; Run the following commands to create the ; rotate sphere rubber bander. ; To start the rotate sphere rubber bander, ; issue (rotsph #t). Drag the mouse while ; holding down the left button. ; To turn off, issue (rotsph #f). (define rotsph (lambda (onoff) (begin (if onoff ; TRUE: Define mouse hooks to turn on and off ; rubber banding (begin ; When button pressed, start rubber banding (display "Rubber band driver: DEFINE.\n") (rbd:push) (define hhhrub #f) (display "Hold mouse button ") (display "and drag to rotate camera.\n") (set! mouse-down-hook (lambda (pe) (set! hhhrub (rbd:view #f pe "orbit")) (dl:dynamic-silhouette-display #f) (rbd:add hhhrub) ) ) ; When button released, stop rubber banding (set! mouse-up-hook (lambda (pe) (rbd:remove hhhrub) (dl:dynamic-silhouette-display #t) ) ) ) ; FALSE: Turn off rubber banding (begin ; Reset the mouse-hook operations (set! mouse-down-hook '()) (set! mouse-up-hook '()) (display "Rubber band driver: UNDEFINE.\n") (rbd:pop) (dl:dynamic-silhouette-display #t) ) ) ; Return the new setting onoff ) )) ;; rotsph |
[Top]
activate | boolean |
base | pick-event |
; rbd:window ; Create an object to view the changes. (define block1 (solid:block (position 0 0 0) (position 10 20 30))) ;; block1 (define rubber-zoom (lambda () ; Create first corner of view window (let ((corner1 (read-event))) ; Create a rbd-window driver, and make it active. (rbd:window #t corner1) ; Using the mouse, select second corner. (let ((corner2 (read-event))) ; stop the rubberbanding (rbd:remove-type rbd:window?) ; Use the rbd window as zoom window (view:zoom-window corner1 corner2) ; refresh the view so changes are visible (view:refresh))))) ;; rubber-zoom ; Issue the following command to recreate a ; zoom rubberbander. Follow the comments in ; the preceding define statement. (rubber-zoom) ;; #[view 1075924776] (rbd:clear #f) ;; () |
[Top]
object | scheme-object |
Description
This extension returns #t if the window rubberband driver is in the active
rubberbander list; otherwise, it returns #f.
; rbd:window? ; Determine if the Boolean is an rbd-window driver. (rbd:window? #t) ;; #f ; Determine if the rbd-window driver is actually ; an rbd-window driver. (rbd:window? (rbd:window #t (read-event))) ; Using the mouse, select a point. ;; #t ; Determine if the rbd-line driver is an rbd-window ; driver. (rbd:window? (rbd:line #t (position 1 2 3))) ;; #f ; clear the rubberbanders (rbd:clear #t) ;; () |
[Top]
None |
; refresh-all ; Refresh the view. (refresh-all) ;; "refreshed" |
[Top]
part | part |
Description
This extension discards the existing entity display list and regenerates
it from the entity data. This is useful when the view zooms in on entities,
because the display may look jagged. This extension destroys the existing
display list, regenerates it from the entities at the new zoom level,
and re-displays the entities in all views associated with the part.
; render:rebuild ; Rebuild and redisplay the display list. (render:rebuild) ;; () ; Refresh the display list for a view. (view:refresh) ;; #[view 10755331601] |
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.