roll
List of: Scheme Extensions
Subjects: History and Roll
Contents: Scheme Support

Action: Rolls to a previous or later state.

Filename: scm/scmext/roll_scm.cxx

APIs: api_pm_roll_n_states, api_pm_roll_to_state

Syntax: (roll [number-of-states=-1] [name-string=NULL]


[end] [start] [history])

Arg Types: number-of-states integer

name-string string

history history

Returns: integer

Description: The optional number-of-states specifies the number of states the model rolls. A negative number means to roll to a previous state, and a positive number means to roll to a later state.


The optional name-string identifies a user-defined name, to which the model should go. If no arguments are specified, the model rolls back one state.


There are two system-named states: start rolls to the beginning of the session, and end rolls to the end of the session. If previous states were deleted, or a limit on the maximum number of states to keep was set, start rolls to the first non-deleted state. If a state was named, (roll name-string) rolls the session back or forward to the identified name. The name is created with the roll:name-state extension.


The optional history is used to find the history stream to roll. The default is the stream associated with the active part.


This extension returns the number of steps rolled.

Example: ; roll

; Roll back and forward

; to previously defined states.

; Create solid block 1,

(define block1


(solid:block (position 0 0 0)


(position 10 10 10)))

;; block1

; Create solid block 2.

(define block2


(solid:block (position 15 15 15)


(position 25 25 25)))

;; block2

; Create solid block 3.

(define block3


(solid:block (position 30 30 30)


(position 40 40 40)))

;; block3

; Roll back to the beginning of the session.

(roll "start")

;; 6

; Roll forward to the end of the session.

(roll "end")

;; 6

; Roll back one step.

(roll)

;; -1

; Define the name of the state.

(roll:name-state "step")

;; "step"

; Roll back two states

(roll -2)

;; -2

; Roll back to the named state.

(roll "step")

;; 2
PDF/SCM/04SC.PDF
HTM/DATA/SCM/SCM/04SC/0113.HTM