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.

rbi:rep-self-int

Action
Repairs self-intersections in the supplied body.
 
Filename
scm/scmext/rbi/rbi_scm.cpp
 
APIs
api_repair_body_self_ints

Syntax
(rbi:rep-self-int body changed-face-list [ao])

Arg Types
body body
changed-face-list face | (face ...)
ao acis-options

Returns
body

Errors
Null body supplied gives RBI_NO_BODY

Duplicate faces gives RBI_BAD_FACE

Non manifold body gives RBI_NON_MANIFOLD

Free (sheet) edge gives RBI_FREE_EDGE

Algorithmic failure gives RBI_INTERNAL or RBI_BAD_OP_ON_ATT

Current limitation gives RBI_NOT_IMPLEMENTED

Unrepairable face loop gives RBI_IRREP_FACE_LOOP

All faces in body being deleted gives RBI_NO_LUMP_LEFT

More than four coedges on intermediate body gives RBI_NOT_4_COEDGES

Unfixable self-intersecting face gives RBI_SELF_INT_FACE

Note that the returned entities in the outcome standard_error_info object are highlighted.

Description
Self-intersecting bodies have mutually intersecting faces, that is, faces intersecting in places other than any common boundaries between them.

This extension is intended to repair any self-intersections on a body that may result from local operations or shelling. This extension does not handle topology changes which presently prevent these operations from completing. Instead, it repairs self-intersections resulting from completed operations. The elementary checks in the operations to prevent self-intersecting bodies are removed.

Body self-intersections made by other operations such as sweeping or blending may be repaired if the body is in a suitable state. Refer to the Limitations section below.

There are a set of faces known to have been changed by the operation. The remaining faces in the body fall into a set of unchanged faces, and the faces in this set do not intersect one another unless along common boundary edges or vertices. In any body the set of unchanged faces may be empty. When the set of changed faces is unknown it defaults to all the faces in the body, and the unchanged faces to an empty set.

Arguments
body identifies the body whose self-intersections need to be repaired.
 
changed-face-list identifies the faces changed by the operation.

ao contains journaling and versioning information.

Limitations
The directions of open edges on periodic curves must be correct. Local Operations and Shelling will do this if option lop_repair_self_int is on or option lop_check_invert is off.

The body is assumed to still consist entirely of valid connected faces with no free edges.

The body was formerly valid and has become self-intersecting as a result of one or more faces passing through other faces during a local operation, or becoming partially or completely coincident with them. Alternatively, the body is composed of valid faces (see below) connected such that traversing it from any start face will always reach the same side of the start face.
The faces involved may be in different shells or lumps.

The faces themselves must be valid except that they may be self-intersecting, or inverted or both.

Self-intersecting faces have some edges that intersect in places other than any common boundary vertices between themselves, but the geometry of faces is assumed not to intersect itself. An example of a self-intersecting face is the side face to a vertical face of a block tapered such that the top face should disappear.

Inverted faces are reversed in sense that the interior is unbounded, and the interior becomes bounded when the face normal and loop directions are reversed, and any 'infinite' (low > high) open curve edges are reversed. An example of an inverted face is the top face when a vertical face of a block is tapered such that it should disappear.

As the method is based in boolean operations, faces are split and do not grow, except then they merge with other faces.

To have api_repair_body_self_ints remove any faces that are given reversed senses during the operation, set option rbi_remove_inv_face to TRUE, and api_remove_and_repair_body will be called at the end of the operation on the reversed faces, and will remove them by growing adjacent faces.
; rbi:rep-self-int
; Example 1
; Set the eye position for a standard view.
(view:set (position 75 25 50) (position 0 0 0)
    (gvector 0 0 1))
;; #[view 1076820424]
; Turn off the perspective view.
(view:set-perspective #f)
;; #f
; Create a block
(define b1 (solid:block (position -25 -25 -25)
    (position 25 25 25)))
;; b1
; Create a cylinder
(define c2 (solid:cylinder (position 0 0 0)
    (position 0 0 50) 10))
;; c2
; Subtract the cylinder from the block.
(define subtract (solid:subtract b1 c2))
;; subtract
; OUTPUT Original

; Render the image
(render)
;; ()
; OUTPUT Rendered

Figure. rbi:rep-self-int - Example 1

; rbi:rep-self-int - Example 2
; Refresh the view
(view:refresh)
;; #[view 1077168320]
; Pull hole out of block into a boss
(option:set "lop_check_invert" #f)
;; #t
; Offset one of the faces.
(define offset (lop:offset-faces (pick:face (ray
    (position 0 0 0) (gvector 0 0 1))) 50))
;; offset
; Repair the intersections
(define repair (rbi:rep-self-int b1))
;; repair
; Check the body
(entity:check b1)
; checked:
;      1 lumps
;      1 shells
;      0 wires
;      8 faces
;      10 loops
;      28 coedges
;      14 edges
;      10 vertices
;; ()
; OUTPUT Original

; Render the image
(render)
;; ()
; OUTPUT Rendered

Figure. rbi:rep-self-int - Example 2

; rbi:rep-self-int - Example 3
; Refresh the view
(view:refresh)
;; #[view 1077168320]
; Slide boss off block
(define move (lop:move-faces (pick:face (ray
    (position 0 0 30) (gvector 1 0 0)))
    (gvector 0 50 0)))
;; move
; OUTPUT Original

; Repair the self-intersections.
(define repair (rbi:rep-self-int b1))
;; repair
; Check the body again. Notice the increase in lumps,
; shells, and faces.
(entity:check b1)
; checked:
;      2 lumps
;      2 shells
;      0 wires
;      9 faces
;      10 loops
;      28 coedges
;      14 edges
;      10 vertices
;; ()
; Render the image.
(render)
;; ()
; OUTPUT Rendered

Figure. rbi:rep-self-int - Example 3

; rbi:rep-self-int - Example 4
; Clear the part
(part:clear)
;; #t
; Recreate the original block and cylinder
(define b1 (solid:block
    (position -25 -25 -25) (position 25 25 25)))
;; b1
(define c2 (solid:cylinder
    (position 0 0 5) (position 0 0 45) 10))
;; c2
(define unite (solid:unite b1 c2))
;; unite
; Make a body with inconsistent face loops
(define incon (lop:offset-faces (pick:face
    (ray (position 0 0 0) (gvector 0 0 1))) -40))
;; incon
; OUTPUT Original

; Repair the face loops
(define repair (rbi:rep-self-int b1))
;; repair
(entity:check b1)
; checked:
;      1 lumps
;      1 shells
;      0 wires
;      8 faces
;      10 loops
;      28 coedges
;      14 edges
;      10 vertices
;; ()
; OUTPUT Repaired Loops

Figure. rbi:rep-self-int - Example 4

; rbi:rep-self-int - Example 5
; Refresh the view
(view:refresh)
;; #[view 1077168320]
; Make a self-intersecting body
(define offset (lop:offset-faces (pick:face
    (ray (position 0 0 0) (gvector 0 0 1))) -50))
;; offset
; OUTPUT Original

; Repair self-intersecting body
(define self (rbi:rep-self-int b1))
;; self
(entity:check b1)
; checked:
;      1 lumps
;      1 shells
;      0 wires
;      7 faces
;      10 loops
;      28 coedges
;      14 edges
;      10 vertices
;; ()
; OUTPUT Repaired Body

Figure. rbi:rep-self-int - Example 5

; rbi:rep-self-int - Example 6
; Make a self-intersecting body with self
; intersecting faces by moving the cylinder
(define move (lop:move-faces (pick:face
    (ray (position 0 0 0)
    (gvector 1 0 0)) 1)
    (gvector 25 0 0)))
;; move
; OUTPUT Original

; Repair self-intersecting body and faces
(define repair (rbi:rep-self-int b1))
;; repair
; OUTPUT Repaired

(entity:check b1)
; checked:
;      1 lumps
;      1 shells
;      0 wires
;      8 faces
;      8 loops
;      36 coedges
;      18 edges
;      12 vertices
;; ()
; Render the image.
(render)
;; ()
; OUTPUT Rendered

Figure.rbi:rep-self-int - Example 6

[Top]