bool:tube
List of: Scheme Extensions
Subjects: Booleans
Contents: Selective Booleans

Action: Performs a selective Boolean operation, as specified in the given option.

Filename: sbool/sbool_scm/selective_scm.cxx

APIs: api_boolean_tube_body

Syntax: (bool:tube blank tool start end opt [acis-opts])

Arg Types: blank body

tool body

start position | (position)

end position | (position)

opt string

acis-opts acis-options

Returns: entity

Description: The bool:tube performs a Boolean operation on the given blank and tool bodies. The type of operation performed is specified by the opt of type Tube-Options. The start and end regions for the operation can be defined using positions or arrays of positions.


The purpose of this is to make selective Booleans more general so they can be used by sweeping and other modeling operations.


The API api_boolean_tube_body, which bool:tube uses, takes two bodies (blank and tube) as input and calls the selective Booleans stage 1 once and stage 2 the number_of_options times. Each time these selective Booleans are called, this function automatically sets up the subgraph from a set of options and start and end conditions.


blank is an input body.


tool is an input body.


start gives the start region for the operation in terms of position or array of positions.


end gives the end region for the operation in terms of position or array of positions.


opt specifies the type of operation performed.


The optional acis-opts contains parameters for versioning and journaling.

Example: ; bool:tube - Example 1

; Create a block

(define b (solid:block (position 0 0 0)


(position 10 10 10)))

;; b

; b => #[entity 2 1]

; set new color for entity b

(entity:set-color b 3)

;; ()

; Create solid cylinder 1

(define c1 (solid:cylinder (position -5 5 2)


(position 15 5 2)1))

;; c1

;set new color for entity c1

(entity:set-color c1 4)

;; ()

; Create solid cylinder 2

(define c2 (solid:cylinder (position -5 5 8)


(position 15 5 8)1))

;; c2

; set new color for entity c2

(entity:set-color c2 5)

;; ()

; Combine solid cylinders 1 and 2

(define c (solid:unite c1 c2))

;; c

; set new color for entity c

(entity:set-color c 6)

;; ()

; OUTPUT Original


; Define the start position

(define start (list (list-ref (entity:faces c) 1)


(list-ref (entity:faces c) 4)))

;; start

; Define the end position

(define end (list (list-ref (entity:faces c) 2)


(list-ref (entity:faces c) 5)))

;; end


(define opt1 (tube:options "keep_law" "x=0"


"bool_type" "UNITE"))

;; opt1

; View details of opt1

opt1

;; #[Tube_Options "keep_law" X=0 "keep_branches"


#f"unite"]

; Define an entity to be solid block "b" with

; entities "b" and "c" removed from the interior

; and top

(define d (bool:tube b c start end opt1))

;; d

; OUTPUT Result



Figure 2-3. bool:tube (Example 1)


; bool:tube - Example 2

; sel_bool unite operations with

; descriptions:

; Delete all entities from the active area.

(part:clear)

;; #t

; create a solid block (vertical rectangle).

(define b1 (solid:block (position -40 0 0)


(position 40 10 10)))

;; b1

; set new color for entity b1

(entity:set-color b1 4)

;; ()

; create solid block 2.

(define b2 (solid:block (position -40 10 0)


(position -30 30 10)))

;; b2

; set new color for entity b1

(entity:set-color b2 5)

;; ()

; create solid block 3.

(define b3 (solid:block (position 30 10 0)


(position 40 30 10)))

;; b3

; set new color for entity b1

(entity:set-color b3 6)

;; ()

; create solid block 4 (center block).

(define b4 (solid:block (position -5 0 0)


(position 5 30 10)))

;; b4

; set new color for entity b1

(entity:set-color b4 2)

;; ()

; OUTPUT Original


; create a blank.

; Unite the 4 block entities.

(define blank (bool:unite b1 b2 b3 b4))

;; blank

; OUTPUT Step 2


; create another solid block.

(define tool (solid:block (position -45 15 0)


(position 45 25 10)))

;; tool

; OUTPUT Step 3


; define the faces

(define faces (entity:faces tool))

;; faces

; Define new color for "faces"

(entity:set-color faces 6)

;;()

; define the start position

(define start (list-ref faces 3))

;; start

; define the end position

(define end (list-ref faces 5))

;; end

; x1 (x) = order of this vertex

; x2 (y) = largest order in component

; x3 (z) = TRUE if from tool

; x4 = TRUE if from blank

; x5 = TRUE if start cell

; x6 = TRUE if end cell

; In this example, there are 4 possible cells that

; could be included in the unite operation.

; The first cell is 0, the last is 3.

; x1 takes on all possible values, 0, 1, 2, and 3.

; x2 is 3.

; x3 is always TRUE if we are doing a unite.

; x4 is always FALSE if we are doing a unite.

; x5 is TRUE if x1 is 0.

; x6 is TRUE if x1 is 3.


(define opts1 (tube:options "keep_law" "x!=x2"


"bool_type" "u"))

;; opts1

; keep all but last cell

(define opts2


(tube:options "keep_law" "x5" "bool_type" "u"))

;; opts2

; keep all start cells

(define opts3 (tube:options "keep_law" "x=2 or


x6""bool_type" "u"))

;; opts3

; keep the second and last cells

(bool:tube blank tool start end opts3)

;; Try opts1, opts2, and opts3.

; OUTPUT Result





Figure 2-4. bool:tube (Example 2)
PDF/SBOOL/02SC.PDF
HTM/DATA/SBOOL/SBOOL/02SC/0004.HTM