Examples of Common Tasks


The following are simple examples using the Scheme AIDE application. Type the command lines, exactly as they appear in these examples, following your Scheme AIDE command prompt. The lines in the examples beginning with semicolons (;) are comment lines that you do not need to type. Lines beginning with two semicolons (;;) indicate responses from the application and are not to be typed. Some examples build on previous ones.

Command Input File

Scheme AIDE can execute commands from a Scheme procedure input file, as illustrated with the initialization file acisinit.scm. A Scheme procedure file can contain commands that create objects, perform actions, set options, etc. An input file is a text file containing Scheme commands and, optionally, comments.

The Scheme command load is used to load and execute an input Scheme procedure file. The input file must exist in your working directory (or in your load path), or you must include the path when you specify the filename. To run Example. Executing the Command Input File, use a text editor to create a text file in your working directory named test.scm containing the text in Example. Sample Command Input File. The following figure shows the result of loading this file.

; Sample input file test.scm
(define b1 (solid:block (position -20 -20 0) (position 20 20 5)))
;; b1
(define s1 (solid:sphere (position 0 0 0) 15))
;; s1
(define new (bool:intersect b1 s1))
;; new

Example. Sample Command Input File

Figure. Command Input File

; Delete all entities from the view
(part:clear)
;; #t
; Load the Scheme input file test.scm
(load "test.scm")
;; ()

Example. Executing the Command Input File

Unite a Block and a Cylinder

This example creates a block and a cylinder, then unites them. The following figure shows the model before and after the entities are united.

; Create a solid block
(define b1 (solid:block (position -20 -20 -20)
         (position 20 20 20)))
;; b1
; Create a cylinder
(define c1 (solid:cylinder (position 20 0 -20)
         (position 20 0 20) 20)))
;; c1
; Unite the two bodies into a new body
(define u1 (bool:unite b1 c1))
;; u1

Example. Unite Block and Cylinder

Figure. Unite Block and Cylinder

Rotate Body

This example rotates the body u1 (after the union) from Example. Unite Block and Cylinder so you can view it from a different angle. A transform is first defined, then applied to the body. The following figure shows the rotated body.

; (part:clear)
; Create a solid block
(define b1 (solid:block (position -20 -20 -20)
          (position 20 20 20)))
;; b1
; Create a cylinder
(define c1 (solid:cylinder (position 20 0 -20)
          (position 20 0 20) 20)))
;; c1
; OUTPUT Before Union
; Unite the two bodies into a new body
(define u1 (bool:unite b1 c1))
;; u1
; Define a transform, t1, to rotate an object
; about the z-axis by 90 degrees
(define t1 (transform:rotation (position 0 0 0 )
          (gvector 0 0 1) 90))
;; t1
; OUTPUT After Union
; Apply the transform t1 to the body u1
(entity:transform u1 t1)
;; #[entity 2 1]
; OUTPUT Rotate/Transform

Example. Rotate Body

Figure. Rotate Body

Save and Load

ACIS models can be saved to a part save file for later retrieval. They can be saved in text mode (file extension .sat) or binary mode (file extension .sab).

This example saves the body u1 created in Example. Rotate Body into a part save file in text format and then retrieves it from that file as a body with a new name.

; Save the model in text mode to file test.sat
(part:save "test" #t)
;; #t
; Delete all the entities
(part:clear)
;; #t
; Nothing in view window now
; Retrieve, or load, the model from the text mode file test.sat
(part:load "test")
;; (#[entity 4 1])

Example. Save and Load

[Top]