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. |
"name-of-option" |
|
value |
|
options |
stch-options |
Errors
max_stitch_tol
option requires a real number as argument.
identify_coincident_faces
option requires an integer value 0, 1, or 2 as an argument.
identify_coincident_faces
option requires integer argument.
fix_body_orientation
option requires boolean argument.
Incorrect stitch
option.
Description
This extension returns an
edg-stch-options
object for use in stitch:edges. This allows the
user to set the
max_stitch
tolerance, and the option of switching ON/OFF coincident faces clustering.
Some of the possible name-of-option and value pairs are:
name-of-option | value | Result |
---|---|---|
identify_coincident_faces |
0 (Default) |
SPASTITCH_COIN_ERROR: The stitcher immediately terminates with a sys_error. The state of the model is rolled back to the unstitched state. |
identify_coincident_faces |
1 |
SPASTITCH_COIN_STITCH: The faces are stitched together along the edge and stitching continues. The coincident face pair is recorded internally and the stitcher throws a warning. Because this produces back-to-back faces, it is likely downstream ACIS operations will fail. This option is strongly discouraged. |
identify_coincident_faces |
2 |
SPASTITCH_COIN_SKIP: The faces are NOT stitched together along the edge, and stitching continues. The coincident face pair is recorded internally and the stitcher throws a warning. This is the recommended setting. |
fix_body_orientation |
#t (Default) |
Set to #t if the possibility exists that one or more of the unstitched face normals point inwards (which would result in the stitched model becoming a void). |
fix_body_orientation |
#f |
Set to #f if the stitch is being performed on faces that are known to have correctly pointing face normals (because of an unhook operation, for example). |
edg-stch-options
object sets the parameters that govern the functionality of stitch:edges.
The parameters are:
max_stitch_tol
Default
value is -1.
identify_coincident_faces
Allowed values are 0, 1, and 2.
Default value is 0.
fix_body_orientation Allowed values are #t, #f. Default value is #t. Set fix_body_orientation to #t if one or more of the unstitched face normals may be pointing inwards (which would result in the stitched model becoming a void). Set fix_body_orientation to #f if stitch is to be performed on faces known to have correctly pointing face normals (because of an unhook operation, for example).
; Load the body (part:load "xxx.sat") ; Make the edge stitch options object "edg-stch-options" (define so (entity:edg-stch-options "identify_coincident_faces" 2 "max_stitch_tol" 0.001 "fix_body_orientation" #f)) ; To check the values of parameters of edg-stch-options, ; type the option's name on the prompt acis> so ; tolerant_max_stitch_tol : 0.001 ; identify_coincident_faces : 2 ; Number of coincident_faces_clusters : Default ; fix_body_orientation : 0 ; For updating the parameters of an existing edg-stch-options object, ; the same scheme command (entity:edg-stch-options) ; can be used by passing the options object as the last argument, for example, ; (entity:edg-stch-options "identify_coincident_faces" 1 so) |
[Top]
"name-of-option" |
|
value |
|
exact-stitch-opt |
exact-stitch-options |
Errors
"split_option"
requires 0 or 1 as an argument.
Incorrect stitch
option.
Description
This extension returns an exact-stitch-options object for use in
entity:stitch. This allows to the user to set the split option
in EXACT_STITCH mode. The exact-stitch-opt object sets the parameters
that govern the entity:stitch in EXACT_STITCH mode. At the moment, the
only parameter is "split_option". It can takes the values 0, 1. The default
value is 0.
If "split_option" is 1, it indicates that the edges of faces that are stitched
are split in order to match coincident edges. Coincident edges on single-sided
faces and of incompatible orientation (opposite coedge sense) are not split.
; Load the body (part:load "xxx.sat") ; Make the stitch options object "exact-stitch-options" (define so (entity:exact-stch-options "split_option" 1)) ;; so ; To check the values of parameters of exact-stitch-options ; just type the option's name on the prompt so ;; split_option : 1 ; For updating an existing exact-stitch-options object ; the same command (entity:exact-stch-options) can be ; used by passing the options object as the last argument. (entity:exact-stch-options "split_option" 0 so) |
[Top]
entity |
|
acis-opts |
Errors
Could not find any edge in the
entity.
Description
The input to this command is any entity containing
TEDGEs, like
BODY,
FACE or a TEDGE itself. This scheme command
internally calls api_check_and_fix_tedge for all the TEDGEs
in the body. It returns a list of TEDGEs that have been repaired. This
scheme command attempts to fix level 30 check errors in TEDGEs in an
entity but does not guarantee that these errors will be fixed. For more details
refer to the documentation of
api_check_and_fix_tedge in
Quick Reference Guide.
; Load the body (part:load "xxx.sat") ;; (#[entity 1 1]) ; Check the entity for error at level 30 (entity:check (entity 1) 30 'ERROR) ;; entid 394240: Error: TCOEDGE and TEDGE geometry appear to be incompatible ;; at edge parameter 4.802094125547, coedge parameter 4.781382099055 ;; checked: ;; 1 lumps ;; 1 shells ;; 0 wires ;; 1 faces ;; 1 loops ;; 3 coedges ;; 3 edges ;; 3 vertices ;; (#[entity 2 1]) ; Call the repair scheme command. (entity:repair-tedges (entity 1)) ;; (#[entity 3 1]) ; Check the body again to confirm there is no error. (entity:check (entity 1) 30 'ERROR) ;; checked: ;; 1 lumps ;; 1 shells ;; 0 wires ;; 1 faces ;; 1 loops ;; 3 coedges ;; 3 edges ;; 3 vertices ;; () |
[Top]
options |
stch-options |
Errors
Incorrect argument, requires a
stitch options object.
Description
This extension returns the list of clusters of coincident faces which got
created during the stitch process.
Example 1 ; Load the body (part:load "xxx.sat") ; Make the tolerant stitch options object "stch-options" (define so (entity:stch-options "identify_coincident_faces" 2 "max_stitch_tol" 0.001)) ;; so ; To check the values of parameters of stch-options ; just type the option's name on the prompt so ;; tolerant_max_stitch_tol : 0.001 ;; identify_coincident_faces : 2 ;; Number of coincident_faces_clusters : Default ; For updating the parameters of an existing stch-options ; object the same scheme command (entity:stch-options ) ; can be used by passing the options object as the last argument (entity:stch-options "identify_coincident_faces" 1 so) ; Call entity:stitch with the stch-options object "so" (entity:stitch (part:entities) so) ; To get the number of coincident faces cluster list identified by entity:stitch so ;; tolerant_max_stitch_tol : 0.001 ;; identify_coincident_faces : 1 ;; Number of coincident_faces_clusters : 3 ; To get the clusters of coincident faces (define coin_list (entity:stch-get-coin-faces so)) ;; coin_list Example 2 |
[Top]
"name-of-option" |
|
value |
|
options |
stch-options |
Errors
max_stitch_tol option
requires a real number as argument.
identify_coincident_faces
option requires an integer value 0, 1 or 2 as an argument.
identify_coincident_faces
option requires integer argument.
Incorrect stitch option.
Description
This extension returns an
edg-stch-options
object for use in entity:stitch. This allows to
the user to set the
max_stitch
tolerance, and the option of switching ON/OFF coincident faces clustering.
Some of the possible name-of-option
and
value pairs are:
name-of-option | value | Result |
---|---|---|
identify_coincident_faces |
0 (Default) |
SPASTITCH_COIN_ERROR: The stitcher immediately terminates with a sys_error. The state of the model is rolled back to the unstitched state. The behavior of stitcher in this mode is not affected by the value set to "careful" option. |
identify_coincident_faces |
1 |
SPASTITCH_COIN_STITCH:
The faces are stitched together along the edge and stitching continues. The
coincident face pair is recorded internally and the stitcher throws a warning.
Since this produces back-to-back faces, it is likely downstream ACIS operations
will fail. This option will be strongly discouraged.
In R12 and later versions, the behavior of this mode when the "careful" option is FALSE (default) is as mentioned above. However when the "careful" option is set to TRUE, with SPASTITCH_COIN_STITCH mode stitcher will behave same as when the "careful" option is FALSE except that it will roll the model back to its initial state before exiting. So, with this mode when the "careful" option is set to TRUE, stitcher keeps the model unstitched, but provides the coincident face information. |
identify_coincident_faces |
2 |
SPASTITCH_COIN_SKIP:
The faces are NOT stitched together along the edge, and stitching continues.
The coincident face pair is recorded internally and the stitcher throws a
warning. This is the recommended setting. In R12 and later versions, the behavior of this mode when the "careful" option is FALSE (default) is as mentioned above. However when the "careful" option is set to TRUE, with SPASTITCH_COIN_SKIP mode stitcher will behave same as when the "careful" option is FALSE except that it will roll the model back to its initial state before exiting. So, with this mode when the "careful" option is set to TRUE, stitcher keeps the model unstitched, but provides the coincident face information. |
stch-options
object sets the parameters that govern the functionality of entity:stitch.
The parameters are:
max_stitch_tol
If
this is not set, an internal algorithm will be used to set its value.
identify_coincident_faces Allowed values are 0, 1, 2. Default value is 0.
; Load the body (part:load "xxx.sat") ; Make the stitch options object "stch-options" (define so (entity:stch-options "identify_coincident_faces" 2 "max_stitch_tol" 0.001)) ;; so ; To check the values of parameters of stch-options ; just type the option's name on the prompt so ;; tolerant_max_stitch_tol : 0.001 ;; identify_coincident_faces : 2 ;; Number of coincident_faces_clusters : Default ; For updating the parameters of an existing stch-options ; object the same scheme command (entity:stch-options ) ; can be used by passing the options object as the last argument. (entity:stch-options "identify_coincident_faces" 1 so) |
[Top]
list |
|
stch-opts |
stitch-options |
"use_old_api" |
|
acis-opts |
Description
This extension attempts to stitch all the entities in the entity list. The
extension can work in 2 modes - EXACT_STITCH, TOLERANT_STITCH. In EXACT_STITCH
mode, entity:stitch stitches together edges only if they are close
within
SPAresabs. In this mode, only
BODYs can be passed into entity:stitch.
In TOLERANT_STITCH mode, entity:stitch attempts to stitch edges that
are not close within
SPAresabs, but are close within the user-specified maximum
stitch tolerance. The scheme extension may make certain edges tolerant in this
mode whenever needed. In this mode, only
BODYs or free
FACEs can be passed into
entity:stitch. A free FACE is a FACE that is a top-level
entity and has no owner.
; entity:stitch ; Stitch faces into a single lump body if possible. ; Load a file containing a bad part (part:load "heal1.sat") ;; (#[entity 2 1] #[entity 3 1] #[entity 4 1] ;; #[entity 5 1]) ; Zoom the view in order to see the part (zoom-all) ;; #[view 1076700200] (entity:stitch (part:entities)) ;; #[entity 6 1] |
[Top]
list |
|
list |
|
stch-opts |
tolerant stitch-options |
acis-opts |
Description
This scheme extension performs non-manifold stitching between entities of one
list (parting faces) with entities in the other (primary bodies).
;entity: stitch-nonmanifold ; A solid block stitched with a face to form a non-manifold body. (define primary-body (solid:block (position 0 0 0) (position 10 10 10))) (define w1 (wire-body(list (edge:linear (position 10 0 0) (position 20 0 0))))) (define w2 (wire-body(list (edge:linear (position 10 10 0) (position 20 10 0))))) (define s1 (sheet:skin-wires (list w1 w2))) (entity:delete (list w1 w2)) (define parting-face (sheet:2d s1)) (define so (entity:stch-options )) ; display stch-options so ; #[Stch_Options ] ; tolerant_max_stitch_tol : To be computed internally ; Identify_Coincident_Faces : Default ; Number of coincident_faces_clusters : Default ; Allow_Void_Shells : Default ; do non manifold stitching (define stch_bodies (entity: stitch-nonmanifold parting-face primary-body so)) (define obj (list-ref stch_bodies 0)) (option:set 'check_level 70) (entity:check obj) |
Figure. Non-manifold Stitching
[Top]
list | edge | (edge...) |
stch-opts | stitch-options |
"use_old_api" |
|
acis-opts | acis-options |
Description
Attempts to stitch together the given entities. stitch:edges works in
EDGE_TOLERANT_STITCH mode. In this mode, the list must contain a list of
EDGEs and only the EDGEs appearing in the list are chosen as
candidates for stitching. The extension will operate only on sheet EDGEs.
A sheet EDGE is an edge which is associated with only one FACE
and hence has only one COEDGE. Further the top level owner of each
given sheet EDGE should either be a free FACE or should be a BODY.
stitch:edges will attempt to stitch edges that are not close within
SPAresabs, but are close within the user-specified maximum
stitch tolerance and may make certain edges tolerant in this mode whenever
needed.
; stitch:edges ; Stitch edges with the other edges in the list. ; prepare block with unhooked face as example (define b1 (solid:block 0 0 0 10 10 10)) ;; b1 ; grab 1st face in block (define f1 (car (entity:faces b1))) ;; f1 ; get original edges (define e1 (entity:edges f1)) ;; e1 ; Unhook the face (define f2 (entity:faces (face:unhook f1))) ;; f2 ; check that b only has 5 faces (entity:check b1) ;; checked: ;; 1 lumps ;; 1 shells ;; 0 wires ;; 5 faces ;; 5 loops ;; 20 coedges ;; 12 edges ;; 8 vertices ;; () ; get new edges (define e2 (entity:edges f2)) ;; e2 ; setup over - now perform stitch, see the edges to be stitched (define edge_list (append e1 e2)) ;; edge_list ; Store the stitched edges (define b2 (car (stitch:edges edge_list))) ;; b2 ; b now has 6 faces and 12 edges, so is fully stitched (entity:check b2) ;; checked: ;; 1 lumps ;; 1 shells ;; 0 wires ;; 6 faces ;; 6 loops ;; 24 coedges ;; 12 edges ;; 8 vertices ;; () |
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.