Action:
|
Computes the OR of two or more entity-filters.
|
|
Filename:
|
kern/kern_scm/filt_scm.cxx
|
|
Syntax:
|
(filter:or filt1 ... filtn)
|
|
Arg Types:
|
filt1
|
entity-filter
|
|
filtn
|
entity-filter
|
|
Returns:
|
entity-filter
|
|
Description:
|
Multiple filters can be combined using the Boolean
or filter to form a single filter that can be applied to a single entity or a list of entities. An entity will be selected if at least one part of the combined filter returns
#t.
|
|
|
filt1 is an entity-filter. The ellipsis ( ... ) indicates one or more
entity-filters.
|
|
Example:
|
; filter:or
|
|
; 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 entities so far 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 the green-or-solid filter.
|
|
(define green-or-solid (filter:or (filter:color 2)
|
|
|
(filter:type "solid?")))
|
|
;; green-or-solid
|
|
; Apply a green-or-solid filter and
|
|
; obtain the entities.
|
|
(part:entities green-or-solid)
|
|
;; (#[entity 2 1] #[entity 5 1] #[entity 6 1]
|
|
;; #[entity 7 1] #[entity 8 1])
|