Action:
|
Returns an ordered list of entities representing the path from one entity to another.
|
|
Filename:
|
kern/kern_scm/ent_scm.cxx
|
|
Syntax:
|
(entity:how-connected entity1 entity2 [scan-type])
|
|
Arg Types:
|
entity1
|
entity
|
|
entity2
|
entity
|
|
scan-type
|
string
|
|
Returns:
|
(entity...)
|
|
Description:
|
Occasionally there are unexpected connections between entities. This can cause routines using the
copy_scan() virtual function, such as
entity:delete, (corresponding to
api api_del_entity) and
entity:copy (corresponding to
api_copy_entity) to do more than what was expected.
|
|
|
This routine can help in understanding how two entities are connected by finding a path from one to the other. It uses
copy_scan to find what is connected to the first entity and then
copy_scan again to find what is connected to the next, and so on. This extension uses an ENTITY_LIST to keep track of what it has already looked at so that the search terminates.
|
|
|
If the second entity is found, this routine returns an ordered list representing the path from the first to the second. If no path is found, it returns an empty list.
|
|
|
entity1 specifies the first entity.
|
|
|
entity2 specifies the second entity.
|
|
|
The optional
scan-type parameter allows specification of the
SCAN_TYPE argument to the
copy_scan function. Valid choices are "unspecified", "copy", "distribute" or "delete"
|
|
Example:
|
; entity:how-connected
|
|
; Create a block
|
|
(define b (solid:block
|
|
|
(position 10 20 30) (position -10 -20 -30)))
|
|
;; b
|
|
(define faces (car (entity:faces b)))
|
|
;; faces
|
|
(entity:how-connected b faces)
|
|
; -> face
|
|
; -> shell
|
|
; -> lump
|
|
; -> body
|
|
;; (#[entity 3 1] #[entity 9 1] #[entity 10 1]
|
|
;; #[entity 2 1])
|