filter:and
List of: Scheme Extensions
Subjects: Filtering
Contents: Kernel

Action: Computes an AND of two or more entity-filters.

Filename: kern/kern_scm/filt_scm.cxx

Syntax: (filter:and filt1 ... filtn)

Arg Types: filt1 entity-filter

filtn entity-filter

Returns: entity-filter

Description: Multiple filters can be combined using the Boolean and filter to form a single filter that can be applied to a single entity or a list of entities. An entity is selected if all parts of the combined filter return #t.


filt1 is an entity-filter. The ellipsis ( ... ) indicates one or more entity-filters.

Example: ; filter:and

; Create solid block 1.

(define block1


(solid:block (position 10 0 10)


(position 20 30 40)))

;; block1

; Create linear edge 2.

(define edge1 (edge:linear (position 0 0 0)


(position 10 10 10)))

;; edge1

; Create circular edge 3.

(define edge2 (edge:circular (position 0 0 0) 20))

;; edge2

; Change the color of the existing entities to red.

(entity:set-color (part:entities) 1)

;; ()

; Create solid sphere 4.

(define sphere1 (solid:sphere


(position 20 30 40) 30))

;; sphere1

; Create solid sphere 5.

(define cyl1 (solid:cylinder


(position 40 0 0) (position 5 5 5) 8))

;; cyl1

; Create linear edge 6.

(define edge3 (edge:linear (position 0 50 0)


(position 50 50 0)))

;; edge3

; Create spline edge 7.

(define edge4 (edge:spline (list


(position 20 20 20) (position 10 20 30)


(position 50 40 10))))

;; edge4

; Define a filter for red curves.

(define red-curves (filter:and (filter:color 1)


(filter:type "edge:circular?")))

;; red-curves

; List the red curve entities.

(filter:apply red-curves (part:entities))

;; (#[entity 4 1])

; The following accomplishes the same thing.

(part:entities red-curves)

;; (#[entity 4 1])
PDF/KERN/13SCF.PDF
HTM/DATA/KERN/KERN/13SCF/0020.HTM