Scheme Extensions

 

 

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.

cell:2d?

Action
Determines if the given cell is of the type CELL2D.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(cell:2d? cell)

Arg Types
cell cell

Returns
boolean

Description
This extension returns #t if the input cell is of the type CELL2D; otherwise, it returns #f.

A CELL2D is a topology entity. It is associated with a lump and consists of a set of faces: DOUBLE_SIDED and BOTH_OUTSIDE. A CELL2D is created using cell:attach with respect to a sheet or mixed-dimension body.

Arguments
cell is a topology entity
; cell:2d?
; Create a planar face.
(define face1 (face:plane (position 0 0 0) 10 10))
;; face1
; Make the planar face a 2D cell.
(define sheet1 (sheet:2d (sheet:face face1)))
;; sheet1
; Attach cellular topology to each lump.
(define cell1 (cell:attach sheet1))
;; cell1
; Determine if the cell is actually a cell.
(cell? (car cell1))
;; #t
; Determine if the cell is a 2D cell.
(cell:2d? (car cell1))
;; #t

[Top]


cell:3d?

Action
Determines if the input cell is of the type CELL3D.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(cell:3d? cell)

Arg Types
cell cell

Returns
boolean

Description
This extension returns #t if the given cell is of the type CELL3D; otherwise, it returns #f.

A CELL3D is a topology entity. It is a sub-portion of a lump and is bounded by faces. The faces are either SINGLE_SIDED, or DOUBLE_SIDED with BOTH_INSIDE containment. A CELL3D is created using cell:attach with respect to a solid or mixed-dimension body.

Arguments
cell is a topology entity
; cell:3d?
; Create a solid block.
(define block1
    (solid:block (position -20 -20 -20)
    (position 20 20 20)))
;; block1
; Attach cellular topology to each lump.
(define cell1 (cell:attach block1))
;; cell1
; Determine if the cellular topology is a cell.
(cell? (car cell1))
;; #t
; Determine if the cellular topology is 3D cell.
(cell:3d? (car cell1))
;; #t

[Top]


cell:area

Action
Gets the total surface area of all faces in the input cell.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_ct_cell_area

Syntax
(cell:area cell [accuracy=0.1])

Arg Types
cell cell
accuracy real

Returns
pair                                           (real . real)

Description
This extension finds the total surface area for all faces in the input cell. If cell is of the type CELL3D, this is the area of all faces used once in the cell. If cell is of the type CELL2D, this is the area of both sides of each face.

The optional accuracy parameter is a percentage used in the area calculation. If it is not specified, it defaults to 0.1%.

This extension returns the pair: area and accuracy-achieved.

The accuracy achieved is always 0 if all faces in the cell are analytic surfaces and the area has been determined to be within the limits of accuracy of the computer. Several faces have their areas evaluated analytically. These include:

A Planar face bounded by linear and/or elliptical edges.
A conical face bounded by linear and/or circular edges and part of the curved surface of a circular cross-section.
A cylindrical face bounded by linear and/or elliptical edges and part of the curved surface of a circular cross-section.
A spherical face bounded by circular edges in the longitudinal or latitudinal planes and either a full sphere surface or a part of such surface.

The accuracy achieved is an estimate of the maximum relative error in the area calculation based on the maximum difference between the calculated value and the true value as a fraction of the true value. In the case of a CELL2D, the areas of both sides of all its faces is used in the calculation. In the case of a CELL3D, the areas of all faces in the CELL3D are used just once in the calculation.

Arguments
cell is a topology entity

accuracy parameter is a percentage used in the area calculation
; cell:area
; Create a solid block.
(define block1
    (solid:block (position -20 -20 -20)
    (position 20 20 20)))
;; block1
; Attach the solid block to a cell.
(define cell1 (cell:attach block1))
;; cell1
; Find the area of the cell.
(cell:area (car cell1))
;; (9600 . 0)
; Find the area of the cell
; with the specified accuracy.
(cell:area (car cell1) 0.5)
;; (9600 . 0)

[Top]


cell:attach

Action
Attaches cellular topology to each lump within each body in the input list.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_ct_attach

Syntax
(cell:attach entity-list [ao])

Arg Types
entity-list entity | (entity ...)
ao acis-options

Returns
entity ...

Description
This extension attaches cellular topology to each lump within each solid or sheet body entity in the given input entity-list. The created cells may be a sheet body (CELL2D), a solid body (CELL3D), or a combination of both. Returns a list of 2D or 3D cell entities.

Arguments
entity-list is the given input entity list.
 
ao contains journaling and versioning information.
; cell:attach
; Create a solid block.
(define block1
    (solid:block (position -20 -20 -20)
    (position 20 20 20)))
;; block1
; Attach the solid block to a cell.
(define cell1 (cell:attach block1))
;; cell1

[Top]


cell:classify-position

Action
Determines the relationship of a given point to a given cell.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_ct_point_in_cell

Syntax
(cell:classify-position cell position [ao])

Arg Types
cell cell
position position
ao acis-options

Returns
integer

Description
This extension determines if a given point (position) is inside, outside, or on the specified cell. cell must be of the type CELL3D.

This extension returns
-1, if the point is inside the cell.
0, if the point is on the cell.
1, if the point is outside the cell.
Arguments
cell is a topology entity.

position is the position of a point.

ao contains journaling and versioning information.
; cell:classify-position
; Create a solid block.
(define block1
    (solid:block (position -20 -20 -20)
    (position 20 20 20)))
;; block1
; Attach the block to a cell.
(define cell1 (cell:attach block1))
;; cell1
; Determine if the following positions
; are on the cell.
(cell:classify-position (car cell1)
    (position 0 0 0))
;; -1
(cell:classify-position (car cell1)
    (position 20 0 0))
;; 0
(cell:classify-position (car cell1)
    (position 40 0 0))
;; 1

[Top]


cell:copy

Action
Creates a new body that is a copy of the given cell.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_ct_copy_cell

Syntax
(cell:copy cell)

Arg Types
cell cell

Returns
           pair

Description
This extension makes a copy of the given cell by creating a one-lump body. The copy is a solid body for a CELL3D or a sheet body for a CELL2D. The newly-created body has cellular topology entity attached to its lump.

This extension returns the pair (new-body . new-cell).

Arguments
cell is a topology entity.
; cell:copy
; Create a solid block.
(define block1
    (solid:block (position -20 -20 -20)
    (position 20 20 20)))
;; block1
; Attach the solid block to a cell.
(define cell1 (cell:attach block1))
;; cell1
; Copy the cell.
(define copy (cell:copy (car cell1)))
;; copy

[Top]


cell:expand

Action
Expands the cellular topology by grouping cells into supercells.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_ct_expand

Syntax
(cell:expand entity-list)

Arg Types
entity-list entity | (entity ... )

Returns
entity ...

Description
This extension expands the cells in the sheet or solid bodies in the entity-list into supercells. This organizes the cells into a hierarchy based on spatial proximity, which allows faster cell-based operations. This extension does not try to expand the cell list into supercells unless 50 or more cells exist. The return list is the input list.

Arguments
entity-list is the given input entity list.
; cell:expand
; Create a solid sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Attach the sphere to a cell.
(define cell1 (cell:attach sphere1))
;; cell1
; Expand the cells into supercells.
(define expand (cell:expand sphere1))
;; expand
(part:clear)
;; #t
; cell:expand
; Additional example,
; Create a lattice with more cells.
(define lattice1 (letrec
    ((loop (lambda (one two three acc)
       (if (= one 3)
           (apply bool:nonreg-unite acc)
           (if (= two 3)
               (loop (+ one 1) 0 0 acc)
               (if (= three 3)
                  (loop one (+ two 1) 0 acc)
                      (let ((org-pos
                          (position (* one 5)
                          (* two 5)
                          (* three 5))))
                  (loop
                      one two (+ three 1)
                      (cons (solid:block org-pos
                          (position:offset org-pos
                          (gvector 10 10 10)))
           acc))))))))) (loop 0 0 0 '())))
;; lattice1
(define cells1 (cell:attach lattice1))
;; cells1
; Expand the cells into supercells.
(define expand (cell:expand lattice1))
;; expand

[Top]


cell:find

Action
Finds the cell associated with a given face.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(cell:find face1 [face2])

Arg Types
face1 entity
face2 entity

Returns
cell

Description
The face1 argument is generally the result of a pick operation and is part of the cell in question.

The optional face2 is a face that is part of the same cell.

The algorithm determines the face's sense (front and back) for face1 and face2. This is used to create a cell relationship. The cells are tested and the proper active cell is returned. This is used as part of graph theory, selective Booleans, and partial sweeping to select the graph elements to keep.

Arguments
face1 argument is generally the result of a pick operation

face2 is a face that is part of the same cell
; cell:find
; Create a selective boolean example.
(define blank (solid:block (position 0 0 0)
    (position 25 10 10)))
;; blank
; blank => #[entity 2 1]
(define b2 (solid:block (position 5 0 0)
    (position 10 5 10)))
;; b2
(define b3 (solid:block (position 15 0 0)
    (position 20 5 10)))
;; b3
(define subtractb2 (solid:subtract blank b2))
;; subtractb2
(define subtractb3 (solid:subtract blank b3))
;; subtractb3
(define tool (solid:cylinder
    (position -5 2.5 5) (position 30 2.5 5)1))
;; tool
(define g (bool:select1 blank tool))
;; g
; Find the face entities of the blank.
(define faces1 (entity:faces blank))
;; faces1
; Pick out the fourth face to locate its cell
(define fourth-face (list-ref faces1 3))
;; fourth-face
; Locate the cell associated with this face
(cell:find fourth-face)
;; #[entity 35 1]
; Verify that this is one of the cells.
(define cells (entity:cells blank))
;; cells
; To continue the selective boolean example,
; create a list of cells to keep. This list is what
; gets passed to bool:select2.

[Top]


cell:flatten

Action
Flattens the cellular topology by removing any supercells.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_ct_flatten

Syntax
(cell:flatten entity-list)

Arg Types
entity-list entity | (entity ... )

Returns
entity ...

Description
The cell:expand extension expands the cells in the sheet or solid bodies in the entity-list into supercells. The cell:flatten extension removes any supercells from the cellular topology attached to each sheet or solid body in the input entity-list. The return value is the input list.

Arguments
entity-list is an given input entity list.
; cell:flatten
; Create a solid sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Attach the sphere to a cell.
(define cell1 (cell:attach sphere1))
;; cell1
; Expand the cells into supercells.
(define expand (cell:expand sphere1))
;; expand
; Remove any supercells from the cellular topology.
(define flatten (cell:flatten sphere1))
;; flatten
; cell:flatten
; Additional example,
; Create a lattice with more cells.
(define lattice1 (letrec
    ((loop (lambda (one two three acc)
       (if (= one 3)
           (apply bool:nonreg-unite acc)
           (if (= two 3)
               (loop (+ one 1) 0 0 acc)
               (if (= three 3)
                  (loop one (+ two 1) 0 acc)
                     (let ((org-pos
                         (position (* one 5)
                        (* two 5)
                         (* three 5))))
                 (loop one two (+ three 1)
                     (cons (solid:block org-pos
                         (position:offset org-pos
                         (gvector 10 10 10)))
           acc))))))))) (loop 0 0 0 '())))
;; lattice1
(define cells1 (cell:attach lattice1))
;; cells1
; Expand the cells into supercells.
(define expand1 (cell:expand lattice1))
;; expand1
; Remove any supercells from the cellular topology.
(define flatten (cell:flatten lattice1))
;; flatten

[Top]


cell:has-volcolor

Action
Queries the cell for a particular attribute volume color.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(cell:has-volcolor cell color)

Arg Types
cell cell3d
color color

Returns
boolean

Description
This extension returns #t if the given cell has the color value "color". Otherwise, the extension returns #f.

Arguments
cell specifies the cell queried for its color value.

color indicates the requested color in the specfied cell. The argument color accepts an integer or the color's name. Valid values for color include:
Black = 0
Red = 1
Green = 2
Blue = 3
Cyan = 4
Yellow = 5
Magenta = 6
White = 7

Limitations
This extension does not accept rgb:color values.

; cell:has-volcolor
(define b1 (solid:block (position 0 0 0) (position 50 50 50)))
; b1
(cell:attach b1)
; (#[entity 2 1])
(define cell_bottom (car (entity:cells b1)))
; cell_bottom
(volcolor:attach cell_bottom red)
; (#[entity 2 1] "red")
(volcolor:attach cell_bottom 3)
; (#[entity 2 1] "red" "blue")
(cell:has-volcolor cell_bottom red)
; #t
(volcolor:remove cell_bottom red)
; (#[entity 2 1] "blue")
(cell:has-volcolor cell_bottom red)
; #f

[Top]


cell:massprop

Action
Gets the mass properties of the input cell.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_ct_cell_mass_pr

Syntax
(cell:massprop cell [selector accuracy
    proj-root proj-normal])

Arg Types
cell cell
selector integer
accuracy real
proj-root position
proj-normal vector

Returns
(string ...) . (real ...)

Description
This extension determines the mass properties of the input cell, which must be of the type CELL3D.

The optional selector argument is an integer: 0, 1, or 2; the default is 1. The selector values determine the type of mass property calculations performed and returned as shown below:
0 indicates volume and accuracy achieved.
1 indicates volume, accuracy achieved, and center of gravity.
2 indicates volume, accuracy achieved, center of gravity, inertia matrix, principal moments, and principal axes.

The optional accuracy argument is a percentage used in the mass property calculation. If it is not specified, the default is 0.1%.

The optional arguments proj-root for a position and proj-norm for a normal vector specify a projection plane for the calculations. The default for the proj-root argument is the center of the box that bounds the body. The default for the proj-norm normal vector is in the direction of the z-axis.

The return value is an associative list based on the value of the selector.

Arguments
selector values determine the type of mass property calculations performed

accuracy argument is a percentage used in the mass property calculation

proj-root for a position and proj-norm for a normal vector specify a projection plane for the calculations
; cell:massprop
; Create a solid block.
(define block1
    (solid:block (position -20 -20 -20)
    (position 20 20 20)))
;; block1
; Attach the block to a cell.
(define cell1 (cell:attach block1))
;; cell1
; Get a list of the cell mass properties.
(cell:massprop (car cell1) 2)
;; (("volume" . 64000) ("accuracy achieved" . 0)
;; ("center of mass" . #[position 0 0 0])
;; ("principal moment x" . 17066666.6666667)
;; ("principal axis x" . #[gvector 1 0 0])
;; ("principal moment y" . 17066666.6666667)
;; ("principal axis y" . #[gvector 0 1 0])
;; ("principal moment z" . 17066666.6666667)
;; ("principal axis z" . #[gvector 0 0 1])
;; ("inertia tensor" 17066666.6666667 0 0 0
;; 17066666.6666667 0 0 0 17066666.6666667))

[Top]


cell:propagate-cface-attribs

Action
Copies the cface volume attributes (ATTRIB_CFACE_VOL) on a lump.

Filename
ct/ct_scm/cell_scm.cxx

APIs
api_ct_propagate_cface_attribs

Syntax
(cell:propagate-cface-attribs lump [acis-options])

Arg Types
lump LUMP
[acis-options] acis-options

Returns
boolean
Description
This extension propagates any cface volume attributes (ATTRIB_CFACE_VOL) descended from the lump specified. Such attributes are intended to represent cell volume data, such as material type. These attributes must be propagated after any change to the model (such as a Boolean) to reflect volume containment and merging.
Arguments
lump specifies the input LUMP.

acis-options contains information related to versioning and journalling.

; cell:propagate-cface-attribs
; Create a solid sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Attach the sphere to a cell.
(define cell1 (cell:attach sphere1))
;; cell1
(define lumps (entity:lumps sphere1))
;; lumps
(cell:propagate-cface-attribs (car lumps))
;;#t

[Top]


cell:remove

Action
Removes cellular topology attached to any lump within each body in the input list.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_ct_remove

Syntax
(cell:remove entity-list)

Arg Types
entity-list entity | (entity ... )

Returns
entity ...

Description
This extension removes cellular topology attached to any LUMP within each sheet or solid body in the input entity-list. The return value is the input list.

Arguments
entity-list is a given input list of entities.
; cell:remove
; Create a solid block.
(define block1
    (solid:block (position -20 -20 -20)
    (position 20 20 20)))
;; block1
; Create a solid sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Attach the solid block and sphere to a cell.
(define cell1 (cell:attach
    (list block1 sphere1)))
;; cell1
; (#[entity 4 1] #[entity 5 1])
; Remove the solid block from cell1.
(define remove (cell:remove block1))
;; remove
; Verify the block has been removed.
cell1
;; (#[(deleted) entity 4] #[entity 5 1])

[Top]


cell:vacate

Action
Modifies a 3D cell from filled to void.

Filename
ct/ct_scm/cell_scm.cxx

APIs
api_ct_vacate_cell

Syntax
(cell:vacate cell [acis-options])

Arg Types
cell cell
[acis-options] acis-options

Returns
boolean
Description
This extension modifies the face sides and containment of all the faces of the cells to change the cell state to void. This scheme does not changes the cell data, it only invalidates the affected cells.
Arguments
cell is a topology entity

acis-options contains information related to versioning and journaling.

; cell:vacate
; Create a solid sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Attach the sphere to a cell.
(define cell1 (cell:attach sphere1))
;; cell1
(cell:vacate (car cell1))
;;#t

[Top]


cells:expand

Action
Transforms the cell lists of lump into a hierarchy of supercells with spatial locality.

Filename
ct/ct_scm/cell_scm.cxx

APIs
api_ct_expand_cells

Syntax
(cells:expand lump [acis-options])

Arg Types
lump LUMP
acis-options acis-options

Returns
boolean

Description
This extension expands the cells of a lump into a hierarchy of supercells with spatial locality. A successful outcome indicates the process ran to completion, even if nothing has been changed.

Arguments
lump specifies the input LUMP

acis-options contains information related to versioning and journaling.

Limitations
May have no effect on lumps with few cells.
; cells:expand
; Create a solid sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Attach the sphere to a cell.
(define cell1 (cell:attach sphere1))
;; cell1
(define lmp (entity:lumps sphere1))
; Expand the lump's cells into supercells.
(cells:expand (car lmp))
;; #t

[Top]


cell?

Action
Determines if the given entity is of the type cell.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(cell? entity)

Arg Types
entity entity

Returns
boolean

Description
This extension returns #t if the given entity is of the type cell; otherwise, it returns #f.

Arguments
entity is the given entity of the type cell
; cell?
; Create a solid block.
(define block1 (solid:block (position -20 -20 -20)
    (position 20 20 20)))
;; block1
; Create a solid sphere.
(define sphere1 (solid:sphere (position 0 0 0) 30))
;; sphere1
; Attach the solid block and sphere to a cell.
(define cell1 (cell:attach
    (list block1 sphere1)))
;; cell1
; Determine if the solid block is a cell type.
(cell? block1)
;; #f
; Determine if the lump is a cell type.
(cell? (car cell1))
;; #t
(cell? (car (cdr cell1)))
;; #t

[Top]


entity:cells

Action
Determines the list of cells associated an entity.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(entity:cells body-list)

Arg Types
body-list entity | (entity ...)

Returns
(entity ...)

Description
This Scheme extension is very useful when doing selective Booleans (for example, bool:select1 and bool:select2), which determine what should be kept and what should be thrown away by the cells that are selected. entity:cells returns a list of entities that are cells.

Arguments
body-list is an input list of entities
; entity:cells
; Create a selective boolean example.
(define blank (solid:block (position 0 0 0)
    (position 25 10 10)))
;; blank
(define b2 (solid:block (position 5 0 0)
    (position 10 5 10)))
;; b2
(define b3 (solid:block (position 15 0 0)
    (position 20 5 10)))
;; b3
(define subtractb2 (solid:subtract blank b2))
;; subtractb2
(define subtractb3 (solid:subtract blank b3))
;; subtractb3
(define tool (solid:cylinder
    (position -5 2.5 5) (position 30 2.5 5)1))
;; tool
(define g (bool:select1 blank tool))
;; g
; Find the cell entities of the blank.
(define cells (entity:cells blank))
;; cells
; Create a list of cells to keep.
; Highlight the portion we're going to throw away.
(define highlight (entity:set-highlight
    (list-ref cells 6) #t))
;; highlight
; #[entity 12 1]
; Create the list of cells we're going to keep.
(define keep-list (list
    (list-ref cells 0)
    (list-ref cells 1)
    (list-ref cells 2)
    (list-ref cells 3)
    (list-ref cells 4)
    (list-ref cells 5)
    (list-ref cells 7)))
;; keep-list
(define select (bool:select2 blank keep-list))
;; select

[Top]


entity:edges

Action
Returns list of all edge entities in an entity or list of entities.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_get_edges_from_all_entities

Syntax
(entity:edges entity-list)

Arg Types
entity-list entity | (entity ...)

Returns
edge | edge ...

Description
Returns a list of the edges for the input entity or entity-list. Returns an empty list when no edges are found.

Arguments
entity-list is a given input list of entities
; entity:edges
; Create a solid block.
(define block1
    (solid:block (position 0 0 0)
    (position 25 25 25)))
;; block1
; List the block's edges.
(entity:edges block1)
;; (#[entity 3 1] #[entity 4 1] #[entity 5 1]
;; #[entity 6 1] #[entity 7 1] #[entity 8 1]
;; #[entity 9 1] #[entity 10 1] #[entity 11 1]
;; #[entity 12 1] #[entity 13 1] #[entity 14 1])

[Top]


entity:faces

Action
Returns list of all face entities for an entity or list of entities.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_get_faces_from_all_entities

Syntax
(entity:faces entity-list)

Arg Types
entity-list entity | (entity ...)

Returns
face | face ...

Description
Returns an empty list when no faces are found.

Arguments
Input argument is an entity-list whose list of all faces is to be obtained
; entity:faces
; Create a solid block.
(define block1
    (solid:block (position 0 0 0)
    (position 25 15 5)))
;; block1
; List the block's faces.
(entity:faces block1)
;; (#[entity 3 1] #[entity 4 1] #[entity 5 1]
;; #[entity 6 1] #[entity 7 1] #[entity 8 1])

[Top]


entity:groups

Action
Returns a list of all groups in which an entity participates.

Filename
scm/scmext/ct/group_scm.cpp

APIs
api_ct_return_groups

Syntax
(entity:groups entity)

Arg Types
entity entity

Returns
list of groups

Description
Returns a list of all groups containing an entity.

Arguments
entity is a given list of input entities
; entity:groups
; Create a block.
(define b1 (solid:block 0 0 0 10 10 10))
; Create a group containing the block.
(define g1 (group b1))
; Retrieve the groups from an entity.
(define l1 (entity:groups b1))

[Top]


entity:vertices

Action
Returns list of all vertices in an entity or list of entities.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
api_get_vertices_from_all_entities

Syntax
(entity:vertices entity-list)

Arg Types
entity-list entity | (entity ...)

Returns
vertex | vertex ...

Description
Returns a list of the vertices for the input entity or entity-list. Returns an empty list when no vertices are found.

Arguments
entity-list is a given list of input entities.
; entity:vertices
; Create a solid block.
(define block1
    (solid:block (position 0 0 0)
    (position 25 25 25)))
;; block1
; List the block's edges.
(entity:vertices block1)
;; (#[entity 3 1] #[entity 4 1] #[entity 5 1]
;; #[entity 6 1] #[entity 7 1] #[entity 8 1]
;; #[entity 9 1] #[entity 10 1])

[Top]


group?

Action
Determines if the given entity is of the type SPAGROUP.

Filename
scm/scmext/ct/group_scm.cpp

APIs
None

Syntax
(group? entity)

Arg Types
entity entity

Returns
boolean

Description
Determines if the given entity is of the type SPAGROUP. This extension returns #t if the given entity is of the type group; otherwise, it returns #f.

Arguments
entity is a given list of input entities
; group?
; Create a block.
(define b1 (solid:block 0 0 0 10 10 10))
; Create a group containing the block.
(define g1 (group b1))
; Is the entity a group?
(group? g1)

[Top]


group

Action
Creates a SPAGROUP entity containing the entities in the input list as members.

Filename
scm/scmext/ct/group_scm.cpp

APIs
api_ct_make_group

Syntax
(group entity-list)

Arg Types
entity-list entity | (entity ...)

Returns
group entity

Description
Creates a SPAGROUP entity and adds the entities in the input list as members. Returns the group entity.

Arguments
entity-list is a given list of input entities.
; group
; Create a block.
(define b1 (solid:block 0 0 0 10 10 10))
; Create a group containing the block.
(define g1 (group b1))

[Top]


group:add

Action
Adds entities to an existing group.

Filename
scm/scmext/ct/group_scm.cpp

APIs
api_ct_add_to_group

Syntax
(group:add group entity-list)

Arg Types
group group entity
entity-list entity | (entity ...)

Returns
list of added entities

Description
This extension adds all the entities in the input list to the specified group and returns the list of added entities.

Arguments
group specifies the existing group to which entities are to be added.
entity-list is a given list of input entities.
; group:add
; Create a block.
(define b1 (solid:block 0 0 0 10 10 10))
; Create a group containing the block.
(define g1 (group b1))
; Create a sphere.
(define s1 (solid:sphere 0 0 0 10))
; Add the sphere to the group.
(group:add g1 s1)

[Top]


group:contains

Action
Tests whether an entity or entities are in a group.

Filename
scm/scmext/ct/group_scm.cpp

APIs
None

Syntax
(group:contains group entity-list)

Arg Types
group group entity
entity-list entity | (entity ...)

Returns
logical

Description
This extension tests whether all the entities in the input list are members of the specified group. Returns TRUE or FALSE.

Arguments
group specifies the group for which entities are tested for membership.
entity-list is a given list of input entities.
; group:contains
; Create a block.
(define b1 (solid:block 0 0 0 10 10 10))
; Create a group containing the block.
(define g1 (group b1))
; Does the group contain the specific entity?
(group:contains g1 b1)

[Top]


group:lose

Action
Removes a group entity and all ATTRIB_SPAGROUPs of those entities attached to the group.

Filename
ct/ct_scm/group_scm.cxx

APIs
api_ct_lose_group

Syntax
(group:lose group [acis-options])

Arg Types
group group entity
[acis-options] acis-options

Returns
boolean
Description
This extension removes the group entity, by removing all the references (in the form of an ATTRIB_SPAGROUP) to the group and the group entity itself.
Arguments
group specifies the group entity to be removed.

acis-options contains information related to versioning and journaling.
; group:lose
; Create a block. 
(define b1 (solid:block 0 0 0 10 10 10))
; Create a group containing the block.
(define g1 (group b1))
; Create a sphere.
(define s1 (solid:sphere 0 0 0 10))
; Add the sphere to the group.
(group:add g1 s1)
; Lose the group
(group:lose g1)
;;#t

[Top]


group:members

Action
Gets a list of all entities in a group.

Filename
scm/scmext/ct/group_scm.cpp

APIs
api_ct_return_ents

Syntax
(group:members group)

Arg Types
group group entity

Returns
list of entities

Description
This extension returns the list of all entities in the specified group and returns the list of member entities.

Arguments
group specifies the group for which the list of member entities are returned.
; group:members
; Create a block.
(define b1 (solid:block 0 0 0 10 10 10))
; Create a group containing the block.
(define g1 (group b1))
; Retrieve the members of the group.
(group:members g1)

[Top]


group:remove

Action
Removes entities from an existing group.

Filename
scm/scmext/ct/group_scm.cpp

APIs
api_ct_remove_from_group

Syntax
(group:remove group entity-list)

Arg Types
group group entity
entity-list entity | (entity ...)

Returns
list of removed entities

Description
This extension removes all the entities in the input list from the specified group. The group entity is lost if all the members are removed. Returns the list of added entities.

Arguments
group specifies the existing group to which entities are to be removed.
entity-list is a given list of input entities.
; group:remove
; Create a block.
(define b1 (solid:block 0 0 0 10 10 10))
; Create a group containing the block.
(define g1 (group b1))
; Create a sphere.
(define s1 (solid:sphere 0 0 0 10))
; Add the sphere to the group.
(group:add g1 s1)
; Remove the block from the group
(group:remove g1 b1)

[Top]


volcolor:attach

Action
Attaches a particular volume attribute from a 3D cell.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(volcolor:attach cell color)

Arg Types
cell CELL3D
color color

Returns
(cell (color | color ...))

Description
This extension returns a pair, constructed with the cell and a list of the volume colors attributes already attached to the cell. If the attachment operation was successful, the new color is shown on the returned list.

Arguments
cell specifies the 3D cell from which a particular volume attribute is to be removed.

color indicates the requested color in the specfied cell. The argument color accepts an integer or the color's name. Valid values for color include:
Black = 0
Red = 1
Green = 2
Blue = 3
Cyan = 4
Yellow = 5
Magenta = 6
White = 7

Errors
Attempting to re-attach an already existing attribute volume color.

; volcolor:attach
(define b1 (solid:block (position 0 0 0) (position 50 50 50)))
; b1
(cell:attach b1)
;(#[entity 2 1])
(define cell_bottom (car (entity:cells b1)))
; cell_bottom
(volcolor:attach cell_bottom red)
; (#[entity 2 1] "red") 
(volcolor:attach cell_bottom 3)
; (#[entity 2 1] "red" "blue")

[Top]


volcolor:colors?

Action
Returns a list of the attribute volume colors available in a given 3D cell.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(volcolor:colors? cell)

Arg Types
cell cell3d

Returns
(color | color ...)

Description
This extension returns a list of the attribute volume colors already attached to the cell. The list of attribute volume colors may differ from the results shown by (volcolor:query cell) if the cell needs propagation after a boolean operation.

Arguments
cell specifies the cell for which a list of attribute volume colors attached to the cell is to be returned.
; volcolor:colors?
(define b1 (solid:block (position 0 0 0) (position 50 50 50)))
; b1
(cell:attach b1)
; (#[entity 2 1])
(define cell_bottom (car (entity:cells b1)))
; cell_bottom
(volcolor:attach cell_bottom red)
; (#[entity 2 1] "red")
(volcolor:attach cell_bottom 3)
; (#[entity 2 1] "red" "blue")
(volcolor:attach cell_bottom 5)
; (#[entity 2 1] "red" "blue" "yellow")
(volcolor:colors? cell_bottom)
; ("red" "blue" "yellow")
(volcolor:remove cell_bottom red)
; (#[entity 2 1] "blue" "yellow")
(volcolor:colors? cell_bottom)
; ("blue" "yellow")

[Top]


volcolor:query

Action
Queries the cell for all attribute volume colors in every cell face.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(volcolor:query cell)

Arg Types
cell cell3d

Returns
( cshell (cface ( color | color ... ) (cface ( color | color ... ) ... )

Description
This extension returns a list of attribute volume colors for every cface, of every cshell belonging to the given cell.

Arguments
cell specifies the cell queried for its attribute volume colors.
; volcolor:query
(define b1 (solid:block (position 0 0 0) (position 50 50 50)))
; b1
(cell:attach b1)
;(#[entity 2 1])
(define cell_bottom (car (entity:cells b1)))
; cell_bottom
(volcolor:attach cell_bottom red)
; (#[entity 2 1] "red")
(volcolor:query cell_bottom)
; ((#[entity 9 1] (#[entity 8 1] "red") (#[entity 7 1] "red") (#[entity 6 1] "red") 
                  (#[entity 5 1] "red") (#[entity 4 1] "red") (#[entity 3 1] "red")))
(volcolor:attach cell_bottom 3)
; (#[entity 2 1] "red" "blue")
(volcolor:query cell_bottom)
((#[entity 9 1] (#[entity 8 1] "red" "blue") (#[entity 7 1] "red" "blue") 
                (#[entity 6 1] "red" "blue") (#[entity 5 1] "red" "blue") 
                (#[entity 4 1] "red" "blue") (#[entity 3 1] "red" "blue")))

[Top]


volcolor:remove

Action
Removes a particular attribute volume color from a given 3D cell.

Filename
scm/scmext/ct/cell_scm.cpp

APIs
None

Syntax
(volcolor:remove cell color)

Arg Types
cell cell3d
color color

Returns
(cell (color | color ...))

Description
This extension returns a pair, constructed with the cell and a list of the volume colors atributes that still remain in the cell. Otherwise, this extension returns a pair (cell . empty_list) when no attributes remain.

Arguments
cell specifies the cell from which a list of attribute volume colors still remain.

color is the attribute volume colors within the specified cell.

Errors
Attempting to remove a non-existing volume color attribute.

; volcolor:remove
(define b1 (solid:block (position 0 0 0) (position 50 50 50)))
; b1
(cell:attach b1)
; (#[entity 2 1])
(define cell_bottom (car (entity:cells b1)))
; cell_bottom
(volcolor:attach cell_bottom red)
; (#[entity 2 1] "red")
(volcolor:attach cell_bottom 3)
; (#[entity 2 1] "red" "blue")
(volcolor:remove cell_bottom red)
; (#[entity 2 1] "blue")

[Top]