Roll Through States
List of: Discussion Topic
Subjects: History and Roll
Contents: Kernel

Once states and branches have been defined, they are easily accessed through the roll extension. Several operations can be grouped together as one operation to roll back using the roll:mark-start and roll:mark-end extensions.

roll Rolls to a previous or later state

roll:mark-end Marks the end of a block of functions for rolling

roll:mark-start Marks the start of a block of functions for rolling

roll:name-state Attaches a name to the current state for rolling

The easiest way of accessing branched states is to name their states and then start roll:name-state with the respectively named states. However, a branch does not have to be named to be accessible.

All of the available branched states can be reached using the roll extension. When using roll, it is important to roll back past the state where the branching begins. Otherwise, roll forward and backward remain on the same branch.

; roll:name-state
; Define a new part
(define my_part (part:new))
;; my_part => #[part 2]

; Define a new view for the part
(define my_view (view:dl my_part))
;; my_view
(env:set-active-part my_part)
;; ()
(part:set-distribution-mode #t)
;; #t

; branching point
(define my_sph1 (solid:sphere (position 0 0 0) 10))
;; my_sph1 => #[entity 1 2]

; one branch
(define my_sph2 (solid:sphere (position 5 10 20) 10))
;; my_sph2 => #[entity 2 2]
; roll back to before this creation
(roll -1)
;; -1

; Any modeling created from now on goes into a
; new history stream.

; second branch
(define my_block (solid:block

(position -5 10 -20) (position 5 -10 20)))
;; my_block => #[entity 3 2]

; roll back to before this creation
(roll -1)
;; -1

; third branch
(define my_block2 (solid:block

(position 10 20 30) (position 15 30 45)))
;; my_block2 => #[entity 4 2]

; Go to a point before the branching
(roll "start")
;; 2

; take one branch
(roll "end")
;; 2

; Go to a point before the branching
(roll "start")
;; 2

; take second branch
(roll "end")
;; 2

; Go to a point before the branching
(roll "start")
;; 2
; take third branch
(roll "end")
;; 2
PDF/KERN/07HIST.PDF
HTM/DATA/KERN/KERN/07HIST/0020.HTM