Scheme Extensions Aa thru Lz |
|
|
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.
|
red | real |
green | real |
blue | real |
Description
Specify red, green, and blue color components with normalized real numbers,
ranging from 0 to 1.
Arguments
red, green and brown
specify the color.
; color:rgb ; Create a blue color object by specifying ; the red, green, and blue values. (define color (color:rgb 0 0 1)) ;; color |
[Top]
object | scheme-object |
Description
This extension returns #t if the object is a color; otherwise, it returns
#f.
; color:rgb? ; Create a blue color object by specifying ; the red, green, and blue values. (define color (color:rgb 0 0 1)) ;; color (color:rgb? color) ;; #t ; Determine if the object is a color. (color:rgb? (env:default-color)) ;; #t |
[Top]
entity | entity |
Description
This extension returns the material (if any) associated with the entity;
otherwise it returns #f.
; entity:material ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 5 30 0) 8)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Get the material assigned to the cylinder. (define material (entity:material cyl1)) ;; material |
[Top]
entity | entity |
Description
This extension returns the material color (if any) associated with the
entity.
; entity:material-color ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 30 0) 20)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Set the color of the material. (entity:set-material-color cyl1 (color:rgb 1 1 1)) ;; () ; Get the color of the material. (entity:material-color cyl1) ;; #[color 1 1 1] |
[Top]
entity | entity |
Description
This extension returns the material reflection properties (if any) associated
with the entity. The first three real values returned are the ambient
reflection, diffuse reflection, and specular reflection, respectively,
which range from 0 to 1. The last real value returned is the exponent.
; entity:material-reflection ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 30 0) 20)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Get the default material reflection properties. (entity:material-reflection cyl1) ;; (1 0.75 0.5 10) |
[Top]
entity | entity |
Description
This extension sets the texture file name in a material associated with
the entity. The return value string specifies the file name of the texture
attached to the material.
; entity:material-texture ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 10 0 30) 20)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Set the material's texture. (entity:set-material-texture cyl1 "brick.bmp") ; Get the material's new texture. ;; () (entity:material-texture cyl1) ;; "brick.bmp" |
[Top]
entity | entity |
Description
This extension gets the transparency property (if any) in the material
associated with a geometric entity. The return value real specifies the
transparency factor, which ranges from 0 (transparent) to 1 (opaque).
; entity:material-transparency ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 5 15) 20)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Set the transparency property of the material. (entity:set-material-transparency cyl1 0.8) ;; () ; Get the material's transparency. (entity:material-transparency cyl1) ;; 0.8 |
[Top]
entity | entity |
Description
This extension returns an integer representing entity sidedness: 0 for
undefined sidedness, 1 for single-sided, and 2 for double-sided. By default,
a newly created entity has undefined render sidedness.
; entity:render-sides ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 8 8 0) 20)) ;; cyl1 ; Set the sidedness for the cylinder. (entity:set-render-sides cyl1 2) ;; () ; Get the sidedness of the cylinder. (entity:render-sides cyl1) ;; 2 |
[Top]
entity-list | entity | (entity ...) |
material | material | #f |
; entity:set-material ; Create a material. (define matter1 (material)) ;; matter1 ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 15 10 5))) ;; block1 ; Assign the material to the block. (entity:set-material block1 matter1) ;; () ; Remove the material from the block. (entity:set-material block1 #f) ;; () |
[Top]
entity | entity |
rgb-color | color |
Description
This extension sets the material color (if any) to be associated with the
entity. This changes the material's color type to "plain". It does not
affect its displacement, reflection, or transparency types or properties.
When a new "plain" color type material is created, the default reflection
type is "phong". It has the following properties:
"ambient factor" | 1 |
"diffuse factor" | 0.75 |
"specular factor" | 0.5 |
"exponent" | 10 |
"specular color" | #[color 1 1 1] |
A high "ambient factor" causes the image to appear bright white in views regardless of the color that has been set. To reveal the color, reset the reflection properties to less extreme values.
; entity:set-material-color ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 10 3) 20)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Get the default type values. (material:color-type matter1) ;; "plain" ; Get the default color values. (material:color-props matter1) ;; (("color" . #[color 1 1 1])) ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Set the color of the material. (entity:set-material-color cyl1 (color:rgb 1 1 0)) ;; () |
[Top]
entity | entity |
ambient-ref | real |
diffuse-ref | real |
specular-ref | real |
exponent | real |
Description
Sets the reflection properties in the material associated with a geometric
entity. This extension sets the material color (if any) to be associated
with the entity. This changes the material's color type to "plain". It
does not affect its displacement, reflection, or transparency types or
properties. The argument rgb_color is the color to set.
When a new "plain" color type material is created, the default reflection
type is "phong". It has the following properties:
"ambient factor" | 1 |
"diffuse factor" | 0.75 |
"specular factor" | 0.5 |
"exponent" | 10 |
"specular color" | #[color 1 1 1] |
A high "ambient factor" causes the image to appear bright white in views regardless of the color that has been set. To reveal the color, reset the reflection properties to less extreme values.
; entity:set-material-reflection ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 30 0) 20)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Get the default material properties. (material:reflection-props matter1) ;; (("ambient factor" . 1) ("diffuse factor" . 0.75) ;; ("specular factor" . 0.5) ("exponent" . 10) ;; ("specular color" . #[color 1 1 1])) ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Set the reflection of the material. (entity:set-material-reflection cyl1 0.4 0.6 0.2 10) ;; () |
[Top]
entity | entity |
filename | string |
Description
This extension sets the texture file name in a material accosted with the
entity. If no named file is found, it returns #f. The color type is set
to "wrapped image" and sets its "file name" property to the filename string.
; entity:set-material-texture ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 30 0) 20)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Set the texture of the material. (entity:set-material-texture cyl1 "brick.bmp") ;; () |
[Top]
entity | entity |
transparency-factor | real |
Description
This extension sets the transparency property in the material associated
with a geometric entity.
; entity:set-material-transparency ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 30 5 20) 20)) ;; cyl1 ; Determine if the cylinder has a material. (entity:material cyl1) ;; #f ; Create a material. (define matter1 (material)) ;; matter1 ; Set the material. (entity:set-material cyl1 matter1) ;; () ; Set the transparency of the material. (entity:set-material-transparency cyl1 0.8) ;; () |
[Top]
entity-list | entity | (entity ...) |
sides | integer |
; entity:set-render-sides ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 8 8 0) 20)) ;; cyl1 ; Set the number of sides for rendering. (entity:set-render-sides cyl1 2) ;; () ; Get the number of sides for rendering. (entity:render-sides cyl1) ;; 2 |
[Top]
entity-list | entity | (entity ...) |
texture-space | entity |
Description
The texture space is used during rendering to control how a wrapped material
entity is applied to any face or solid body. Refer to texture-space:set-prop
for more details.
; entity:set-texture-space ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position -25 -25 -25))) ;; block1 ; Create a texture space. (define texture1 (texture-space "auto axis")) ;; texture1 ; Assign the texture space to the block. (entity:set-texture-space block1 texture1) ;; () (define texture (entity:texture-space block1)) ;; texture |
[Top]
entity | entity |
; entity:texture-space ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 15 25 5))) ;; block1 ; Create a texture space. (define tspace1 (texture-space "auto axis")) ;; tspace1 ; Assign the texture space to the block. (entity:set-texture-space block1 tspace1) ;; () ; Inquire the texture space assigned to the block. (entity:texture-space block1) ;; #[entity 3 1] |
[Top]
colors | integer |
widths | integer | (integer ...) |
heights | integer | (integer ...) |
filename | string | (integer ...) |
Description
This extension creates an environment map from data supplied in a file
or the command line.
Environment maps simulate reflections that cannot be viewed in the Basic
Rendering Component "flat" or "gouraud" render modes; use the Advanced
Rendering Component to view reflections.
An environmental map is an entity associated with rendering reflections.
It may be thought of as the six faces of a cube surrounding a model. Each
of the inward facing faces contains an image that is wrapped onto reflective
objects during rendering. Therefore, environmental maps only provide direction
reflections. Reflections of reflections requires ray tracing rendering
methods.
Environmental maps are saved when the part is saved. It is represented
in the form #[entity m n], where m refers to the entity
and n to the part.
; environment-map:data ; Create an environment map from the supplied data. (define emap1 (environment-map:data 3 20 20 "emap.data")) ;; emap1 ; Assign the environment map to an entity. (render:set-environment-map emap1) ;; () ; Define a sphere. (define sphere1 (solid:sphere (position 0 0 0) 30)) ;; sphere1 ; Define a material. (define matter1 (material)) ;; matter1 ; Set the reflection type to be "environment". (material:set-reflection-type emap1 "environment") ;; () ; Set the entity and the material. (entity:set-material sphere1 matter1) ;; () ; Set the render mode to full. (render:set-mode "full") ;; () ; Render the image. (render) ;; () |
[Top]
img+x | string |
img-x | string |
img+y | string |
img-y | string |
img+z | string |
img-z | string |
Description
This extension creates a six sided cubical environment map used to simulate
reflections. Environment maps simulate reflections that cannot be viewed
in the Basic Rendering Component "flat" or "gouraud" render modes. Use
the Advanced Rendering Component to view reflections.
An environmental map is an entity associated with rendering reflections.
It may be thought of as the six faces of a cube surrounding a model. Each
of the inward facing faces contains an image that is wrapped onto reflective
objects during rendering. Therefore, environmental maps only provide direction
reflections. Reflections of reflections require ray tracing rendering
methods. Environmental maps are saved when the part is saved. It is represented
in the form #[entity m n], where m refers to the entity
and n to the part.
; environment-map:lwi ; Create an environment-map from LightWorks ; Image format data files. (define emap1 (environment-map:lwi "xp.lwi" "xm.lwi" "yp.lwi" "ym.lwi" "zp.lwi" "zm.lwi")) ;; emap1 ; Render the set environment map. (render:set-environment-map emap1) ;; () ; Define a sphere. (define sphere1 (solid:sphere (position 0 0 0) 30)) ;; sphere1 ; Define a material. (define matter1 (material)) ;; matter1 ; Set the reflection type of the material. (material:set-reflection-type matter1 "environment") ;; () ; Set the material onto the sphere. (entity:set-material sphere1 matter1) ;; () ; Set the render mode to full. (render:set-mode "full") ;; () ; Render the image. (render) ;; () |
[Top]
light-type | string |
Description
A light represents a source of illumination in a rendered scene. Light
properties can be set using light:set-prop
and queried with light:props.
Basic rendering permits the creation and deletion of shadow maps, but does
not display shadows. The Advanced Rendering Component supports the display
of shadows from certain light types.
; light ; What type of lights are available. (light:types) ;; ("ambient" "distant" "eye" "point" "spot") ; Create a spot light. (define light1 (light "spot")) ;; light1 |
[Top]
None |
Description
This extension returns the list of all active lights.
; light:list ; Set active light 1. (define distant1 (light "distant")) ;; distant1 ; Set active light 2. (define spot1 (light "spot")) ;; spot1 ; Set active light 3. (define ambient1 (light "ambient")) ;; ambient1 ; Put the three active lights into the light list. (light:set #t (list distant1 spot1 ambient1)) ;; () ; Get the list of all active lights. (light:list) ;; (#[entity 2 1] #[entity 3 1] #[entity 4 1]) |
[Top]
entity | entity |
; light:on? ; Set active light 1. (define distant1 (light "distant")) ;; distant1 ; Determine if a light is active. (light:on? distant1) ;; #f (light:set #t distant1) ;; () ; Determine if a light is active. (light:on? distant1) ;; #t |
[Top]
light-type | light |
Description
This extension returns a list of the light-type, followed by pairs containing
the property name and the present value.
; light:props ; Create a distant light. (define distant1 (light "distant")) ;; distant1 ; Get the properties of the distant light. (light:props distant1) ;; (("intensity" . 1) ("color" . #[color 1 1 1]) ;; ("location" . #[gvector 0 0 1]) ;; ("to" . #[gvector 0 0 0]) ("shadows" . #f) ;; ("shadow resolution" . 256) ("shadow quality" . 4) ;; ("shadow softness" . 1)) ; Create a spot light. (define spot1 (light "spot")) ;; spot1 ; Get the properties of the spot light. (light:props spot1) ;; (("intensity" . 1) ("color" . #[color 1 1 1]) ;; ("location" . #[gvector 0 0 1]) ;; ("to" . #[gvector 0 0 0]) ("fall off" . 0) ;; ("cone angle" . 60) ("cone delta angle" . 5) ;; ("beam distribution" . 2) ("shadows" . #f) ;; ("shadow resolution" . 256) ("shadow quality" . 4) ;; ("shadow softness" . 1)) |
Top]
on-off | boolean |
light-list | light | (light ... ) |
Description
Before executing this extension, create lights and set their parameters.
; light:set ; Set active light 1. (define distant1 (light "distant")) ;; distant1 ; Set active light 2. (define spot1 (light "spot")) ;; spot1 ; Set active light 3. (define ambient1 (light "ambient")) ;; ambient1 ; Put the three active lights into the light list. (light:set #t (list distant1 spot1 ambient1)) ;; () ; Get the list of all active lights. (light:list) ;; (#[entity 2 1] #[entity 3 1] #[entity 4 1]) |
[Top]
light | light |
name | string |
value | real | integer | string | color | gvector |
Description
The following lists the property names and associated default values.
Note: Only property names and values associated with a specific light
entity can be set.
"ambient" illuminates all surfaces equally regardless of orientation. The intensity of the source (as a scalar quantity) is determined by intensity and color. The default values are:
intensity | 1.0 (real) |
color | #[color 1 1 1] |
"distant" projects parallel light from a distant source. An orthographic projection is set up with a camera positioned at the location point of the light and directed towards the to point of the light. Clipping planes are set to ensure that entities are not excluded. The default values are:
intensity | 1.0 (real) |
color | #[color 1 1 1] |
location | #[gvector 0 0 1] |
to | #[gvector 0 0 0] |
shadows | #f (boolean) |
shadow resolution | 256 (int) |
shadow quality | 4 (int) |
shadow softness | 1.0 (real) |
"spot" directs light from a spot source constrained to a cone. A perspective projection is set up with a camera positioned at the light's location point, and directed towards the light's to point. The field of view is specified by cone angle. Clipping planes are set to exclude entities behind the light. The default values are:
intensity | 1.0 (real) |
color | #[color 1 1 1] |
location | #[gvector 0 0 1] |
to | #[gvector 0 0 0] |
fall off | 0 (integer) |
cone angle | 0.0 (real) |
cone delta angle | 5.0 (real) |
beam distribution | 2.0 (real) |
shadows | #f (boolean) |
shadow resolution | 256 (int) |
shadow quality | 4 (int) |
shadow softness | 1.0 (real) |
"eye" emits light from the view position. No shadows are ever cast from an eye light. The default values are:
intensity | 1.0 (real) |
color | #[color 1 1 1] |
"point" emits light from a point equally in all directions. The position of the light is specified by location. The default values are:
intensity | 1.0 (real) |
color | #[color 1 1 1] |
location | #[gvector 0 0 1] |
fall off | 0 (integer) |
shadows | #f (boolean) |
shadow resolution | 256 (int) |
shadow quality | 4 (int) |
shadow softness | 1.0 (real) |
; light:set-prop ; Create a spot light. (define spot1 (light "spot")) ;; spot1 ; Get the properties of the spot light. (light:props spot1) ;; (("intensity" . 1) ("color" . #[color 1 1 1]) ;; ("location" . #[gvector 0 0 1]) ;; ("to" . #[gvector 0 0 0]) ("fall off" . 0) ;; ("cone angle" . 60) ("cone delta angle" . 5) ;; ("beam distribution" . 2) ("shadows" . #f) ;; ("shadow resolution" . 256) ("shadow quality" . 4) ;; ("shadow softness" . 1)) ; Set properties for the spot light. (light:set-prop spot1 "color" (color:rgb 0.5 0.5 0.5)) ;; () ; Get the properties of the spot light. (light:props spot1) ;; (("intensity" . 1) ;; ("color" . #[color 0.5 0.5 0.5]) ;; ("location" . #[gvector 0 0 1]) ;; ("to" . #[gvector 0 0 0]) ("fall off" . 0) ;; ("cone angle" . 60) ("cone delta angle" . 5) ;; ("beam distribution" . 2) ("shadows" . #f) ;; ("shadow resolution" . 256) ("shadow quality" . 4) ;; ("shadow softness" . 1)) ; Create a point light. (define point1 (light "point")) ;; point1 ; Set properties for the point light. (light:set-prop point1 "shadows" 1) ;; () |
[Top]
light | light |
; light:type ; Create a spot light. (define spot1 (light "spot")) ;; spot1 ; Determine the type of light. (light:type spot1) ;; "spot" |
[Top]
None |
Description
This extension returns all valid light types as a list of strings.
; light:types ; Get a list of the available light types. (light:types) ;; ("ambient" "distant" "eye" "point" "spot") |
[Top]
object | scheme-object |
; light? ; Create a spot light. (define light1 (light "spot")) ;; light1 ; Determine if the object is a light. (light? light1) ;; #t |
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.