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.
|
edge | entity| ( entity ....) |
max_points | integer |
scm_string | string |
acis-opts | acis-options |
; edge:facet
; Create a circular edge (define c1 (edge:circular (position 0 0 0) 10)) ;; c1 ;Facet the edge. (edge:facet c1 "ro") *** Warning (spaacis/src:FAC_MAX_NPTS) max npts exceeded and facets may not cover edge ;; (("count of facet points" . 24) ("count of problems" . 0) ("rendering object" . #[rendering-object 185977b8])) |
[Top]
entity | entity |
Description
This extension counts the number of facets in the input entity. This procedure
does not facet the entities. The user must call entity:facet
to facet them or nothing prints.
; entity:count-facets ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 10 10 10))) ;; block1 ; Facet the block. (entity:facet block1) ;; 12 ; Count the number of facets in the block. (entity:count-facets block1) ;; 12 |
[Top]
entity-list |
|
apply_to_descendents |
; entity:delete-facets ; Create and facet a block, then delete the facets. (define block1 (solid:block (position 0 0 0) (position 20 20 20))) ;; block1 (entity:facet block1) ;; 12 (entity:delete-facets block1 #t) ;; #[entity 2 1] (entity:count-facets block1) ;; 0 |
[Top]
entity-list | entity | (entity ...) |
view | view |
hide | boolean |
Description
This extension returns the number of facets displayed from the input
entity-list. This is a temporary
display and does not stay permanently on the screen.
; entity:display-facets ; Create and facet a block, then display the facets. (define block1 (solid:block (position 0 0 0) (position 25 25 25))) ;; block1 ; Facet the solid block. (entity:facet block1) ;; 12 ; Display the facets of the solid block. (entity:display-facets block1) ;; () |
[Top]
entity-list | entity | (entity ...) |
view | view |
unfaceted-only | boolean |
acis-opts | acis-options |
; entity:facet ; Create a block. (define block1 (solid:block (position 0 0 0) (position 25 18 10))) ;; block1 ; Facet the block. (entity:facet block1) ;; 12 (entity:display-facets block1) ;; () |
[Top]
entity-list | entity | (entity ...) |
acis-opts | acis-options |
Description
Gets the area of the facets currently attached to the entity. The entity must
be already faceted for this to be effective. Any parts of the entity not
faceted will be ignored.
; entity:facet-area ; Create a solid sphere. (define sphere1 (solid:sphere (position 0 0 0) 9)) ;; sphere1 ; Facet the sphere. (entity:facet sphere1) ;; 698 ; Calculate the area of the facets of the sphere. (entity:facet-area sphere1) ;; 1010.65030563994 |
[Top]
entity | entity |
Description
This extension returns #t if the
entity
is a face and has been faceted or if the
entity
is a higher-level entity and all the faces it contains have been faceted;
otherwise, it returns #f.
; entity:faceted? ; Create a cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 8 8 8) 20)) ;; cyl1 ; Determine if the cylinder is faceted. (entity:faceted? cyl1) ;; #f ; Facet the cylinder. (entity:facet cyl1) ;; 96 (entity:display-facets cyl1) ;; () ; Determine if the cylinder is faceted. (entity:faceted? cyl1) ;; #t |
[Top]
entity-list | entity | (entity ...) |
view | view |
scale | real |
hide | boolean |
acis-opts | acis-options |
Description
This extension prints the facets of an entity or a list of entities. If no
entities are specified, then all entities that are both displayed and faceted
are printed. This procedure does not facet the entities. The user must call
entity:facet to facet them or nothing prints.
; entity:print-facets ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 10 10 10))) ;; block1 ; Facet the block. (entity:facet block1) ;; 12 (entity:display-facets block1) ;; () ; Print the list of facets. (entity:print-facets block1) ;; () |
[Top]
entity | entity |
acis-opts | acis-options |
Description
This extension returns the entity's refinement. If no refinement is assigned,
this extension returns #f. The optional argument
acis-opts
can be used to enable journaling and versioning options.
"surface tolerance" | is the maximum distance between facet and true surface. |
"last used surface tolerance" | specifies the previously set surface tolerance. |
"normal tolerance" | is the maximum difference between any two normals of facet |
"aspect ratio" | is the approximate aspect ratio of each cell in grid. |
"max edge length" | is the maximum size of an edge of a facet. |
"min v grid lines" | is the minimum number v grid lines used to display a face. |
"min u grid lines" | is the minimum number u grid lines used to display a face |
"max grid lines" | limits the grid lines of a parametric grid for the surface of a face. |
"grading" | adjusts facets to get better parametric aspect ratio of a grid cell. |
"grid mode" | specifies whether a grid is used and whether the points where the grid cuts the edge is inserted to the edge. |
"triang mode" | specifies how much triangulation to do. |
"adjust mode" | specifies type of triangle smoothing to do. Determines if facet nodes should be adjusted for smoothing. Also determines if the grid points should be adjusted or not. |
"surf mode" | specifies the type of surface. |
Available surface types are: | |
AF_SURF_ALL | all surface type |
AF_SURF_REGULAR | a surface with planar cells |
AF_SURF_IRREGULAR | a surface with possibly nonplanar cells |
AF_SURF_PLANE | a planar surface |
AF_SURF_CONE | a cylindrical or conical surface |
AF_SURF_SPHERE | a spherical surface |
AF_SURF_TORUS | toroidal surface |
AF_SURF_SPLINE | a spline surface |
; entity:refinement ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 30 0) 20)) ;; cyl1 ; Create a refinement. (define refine1 (refinement)) ;; refine1 ; Get the default refinement values. (refinement:props refine1) ;; (("surface tolerance" . -1) ;; ("normal tolerance" . 15) ;; ("aspect ratio" . 0) ;; ("max edge length" . 0) ;; ("min v_grid lines" . 0) ;; ("min u_grid lines" . 0) ;; ("max grid lines" . 3000) ;; ("grading" . #f) ;; ("grid mode" . "AF_GRID_INTERIOR") ;; ("triang mode" . "AF_TRIANG_FRINGE_2") ;; ("adjust mode" . "AF_ADJUST_NONE") ;; ("surf mode" . "AF_SURF_ALL")) ; Set the properties of the refinement. (refinement:set-prop refine1 "surface tolerance" 0.5) ;; () ; Attach the refinement to the cylinder. (define refine (entity:set-refinement cyl1 refine1)) ;; refine ; Get the cylinder's refinement. (define get-refine (entity:refinement cyl1)) ;; get-refine |
[Top]
entity | entity |
Description
This extension returns a list of all the refinements attached to an
ENTITY. Refer to Scheme extension entity:refinement
for more information.
; entity:refinements ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 30 0) 20)) ;; cyl1 ; Create a refinement. (define refine1 (refinement)) ;; refine1 ; Get the default refinement values. (refinement:props refine1) ;; (("surface tolerance" . -1) ;; ("normal tolerance" . 15) ;; ("aspect ratio" . 0) ("max edge length" . 0) ;; ("min v_grid lines" . 0) ;; ("min u_grid lines" . 0) ;; ("max grid lines" . 3000) ;; ("grading" . #f) ;; ("grid mode" . "AF_GRID_INTERIOR") ;; ("triang mode" . "AF_TRIANG_FRINGE_2") ;; ("adjust mode" . "AF_ADJUST_NONE") ;; ("surf mode" . "AF_SURF_ALL")) ; Set the properties of the refinement. (refinement:set-prop refine1 "normal tolerance" 15) ;; () ; Attach the refinement to the cylinder. (define attach (entity:set-refinement cyl1 refine1)) ;; attach ; Get the cylinder's refinement. (entity:refinement cyl1) ;; #[entity 3 1] ; Get all the cylinder's refinements. (define all (entity:refinements cyl1)) ;; all |
[Top]
entity-list | entity | (entity ...) |
refine | refinement | boolean |
acis-opts | acis-options |
Description
The argument
entity-list
specifies an entity or list of entities to attach a refinement. This extension
returns the input
entity-list. Refer to Scheme extension
entity:refinement for more information.
; entity:set-refinement ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 8 8 0) 20)) ;; cyl1 ; Create a refinement. (define refine1 (refinement)) ;; refine1 ; Get the default refinement values. (refinement:props refine1) ;; (("surface tolerance" . -1) ;; ("normal tolerance" . 15) ;; ("aspect ratio" . 0) ("max edge length" . 0) ;; ("min v_grid lines" . 0) ;; ("min u_grid lines" . 0) ;; ("max grid lines" . 3000) ("grading" . #f) ;; ("grid mode" . "AF_GRID_INTERIOR") ;; ("triang mode" . "AF_TRIANG_FRINGE_2") ;; ("adjust mode" . "AF_ADJUST_NONE") ;; ("surf mode" . "AF_SURF_ALL")) ; Set the properties of the refinement. (refinement:set-prop refine1 "aspect ratio" 0.5) ;; () ; Set the refinement on the cylinder. (define refine (entity:set-refinement cyl1 refine1)) ;; refine ; Remove the refinement from the cylinder. (define remove (entity:set-refinement cyl1 #f)) ;; remove |
[Top]
entity-list | entity | (entity ...) |
filename | string |
Description
The argument
entity-list
specifies the entity or list of entities to include facet information. This
extension returns #t if the operation is successful.
; entity:write-facets ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 15 15 15))) ;; block1 ; Facet the block. (entity:facet block1) ;; 12 ; Write the list of facets to a file. (entity:write-facets block1 "eraseme") ;; () |
[Top]
entity-list | entity | (entity ...) |
filename | string |
Description
The argument
entity-list
specifies the entity or list of entities to include facet information. This
extension returns #t if the operation is successful. The format of the file is
one triangle per line as follows: v1.X v1.Y v1.Z v2.X v2.Y v2.Z v3.X v3.Y v3.Z
; entity:write-raw-facets ; Create a solid block. (define block1(solid:block (position 0 0 0) (position 15 15 15))) ;; block1 ; Facet the block. (entity:facet block1) ;; 12 ; Write the list of facets to a file. (entity:write-raw-facets block1 "eraseme") ;; () |
[Top]
None |
Description
A refinement is an entity created in the active part that controls how closely
the surfaces of entities are approximated by their faceted representation. A
refinement is associated with a face, shell, lump, or solid body. The
properties of the refinement are set using refinement:set-prop.
Refer to Scheme extension entity:refinement for
more information.
; refinement ; Create a new refinement. (define refine (refinement)) ;; refine |
[Top]
None |
Description
This extension returns the current default refinement. Refer to Scheme
extension entity:refinement for more information.
Refer to class
REFINEMENT for the default values.
; refinement:default ; Create a new refinement. (define refine1 (refinement)) ;; refine1 ; Set the properties of refine. (refinement:set-prop refine1 "max edge length" 11) ;; () ; Determine the properties of refine. (refinement:props refine1) ;; (("surface tolerance" . -1) ;; ("normal tolerance" . 15) ;; ("aspect ratio" . 0) ("max edge length" . 11) ;; ("min v_grid lines" . 0) ;; ("min u_grid lines" . 0) ;; ("max grid lines" . 3000) ("grading" . #f) ;; ("grid mode" . "AF_GRID_INTERIOR") ;; ("triang mode" . "AF_TRIANG_FRINGE_2") ;; ("adjust mode" . "AF_ADJUST_NONE") ;; ("surf mode" . "AF_SURF_ALL")) ; Set refine as the default. (refinement:set-default refine1) ;; () ; Create a new refinement with default properties. (define refine2 (refinement)) ;; refine2 ; Get the default refinement (define refine (refinement:default)) ;; refine |
[Top]
refinement | refinement |
Description
This extension returns a list of pairs of refinement criteria and their values.
; refinement:props ; Create a refinement. (define refine1 (refinement)) ;; refine1 ; Determine the properties of a refinement. (refinement:props refine1) ;; (("surface tolerance" . -1) ;; ("normal tolerance" . 15) ;; ("aspect ratio" . 0) ("max edge length" . 0) ;; ("min v_grid lines" . 0) ;; ("min u_grid lines" . 0) ;; ("max grid lines" . 3000) ("grading" . #f) ;; ("grid mode" . "AF_GRID_INTERIOR") ;; ("triang mode" . "AF_TRIANG_FRINGE_2") ;; ("adjust mode" . "AF_ADJUST_NONE") ;; ("surf mode" . "AF_SURF_ALL")) |
[Top]
refinement | refinement |
acis-opts | acis-options |
Description
Input argument refinement is set as the default refinement.
; refinement:set-default ; Create a refinement. (define refine1 (refinement)) ;; refine1 ; Set the default refinement. (refinement:set-default refine1) ;; () |
[Top]
name | string |
refinement | refinement |
value | real | integer |
name-value-list | pair |
Description
This extension returns the property's previous value. Refer to Scheme extension
entity:refinement for more information.
; refinement:set-prop ; Create a new refinement. (define refine1 (refinement)) ;; refine1 ; Set a property of the refinement. (refinement:set-prop refine1 "aspect ratio" 0.5) ;; () ; Determine the properties of a refinement. (refinement:props refine1) ;; (("surface tolerance" . -1) ;; ("normal tolerance" . 15) ;; ("aspect ratio" . 0.5) ("max edge length" . 0) ;; ("min v_grid lines" . 0) ;; ("min u_grid lines" . 0) ;; ("max grid lines" . 3000) ("grading" . #f) ;; ("grid mode" . "AF_GRID_INTERIOR") ;; ("triang mode" . "AF_TRIANG_FRINGE_2") ;; ("adjust mode" . "AF_ADJUST_NONE") ;; ("surf mode" . "AF_SURF_ALL")) ; Set the default property of the refinement. (refinement:set-default refine1) ;; () |
[Top]
object | scheme-object |
; refinement? ; Create a refinement. (define refine1 (refinement)) ;; refine1 ; Determine the refinement is actually a refinement. (refinement? refine1) ;; #t |
[Top]
None |
Description
This extension creates a data structure,
VERTEX_TEMPLATE. The newly created structure sets up storage
for the tokens used for position, normal, color, and uv. When the model
is subsequently faceted, the polygon's vertices contain data for each of these
tokens.
; vertex-template:set-default ; Set up the default vertex template. (vertex-template:set-default) ; Use-count : 0 ; Tokens : ; POSITION_TOKEN ; NORMAL_TOKEN ; COLOR_TOKEN ; UV_TOKENS ;; #t ; Create a solid block. (define block1 (solid:block (position -10 -10 -10) (position 5 10 15))) ;; block1 ; Set up a material. (define mat1 (material)) ;; mat1 (material:set-color-type mat1 "blue marble") ;; () (entity:set-material block1 mat1) ;; () ; Facet the block. (entity:facet block1) ;; 12 ; Set the facet color. (define color (entity:set-facet-color block1 (gvector 1 1 1))) ;; color |
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.