Scheme Extensions Ma thru Zz

 

 

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.

material

Action
Creates a material for rendering. The default material is "plain".

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
api_rh_create_material

Syntax
(material)

Arg Types
None

Returns
material
; material
; Create a material.
(define mat1 (material))
;; mat1
; 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 mat1)
;; ()
; Remove the material attribute.
(entity:set-material block1 #f)
;; ()

[Top]


material:color-props

Action
Gets the properties of a material's color component.

Filename
scm/scmext/rnd/mclr_scm.cpp

APIs
api_rh_get_color_comp

Syntax
(material:color-props material)

Arg Types
material material

Returns
((string . real | integer | string | color) ...)

Description
This extension returns a list containing pairs of the property name and its present value.

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.

Arguments
material specifies the color material entity.
; material:color-props
; 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 mat1 (material))
;; mat1
; Get the default material color type.
(material:color-type mat1)
;; "plain"
; Get the default material color properties.
(material:color-props mat1)
;; (("color" . #[color 1 1 1]))
; Set the material.
(entity:set-material cyl1 mat1)
;; ()
; Set the color of the material.
(entity:set-material-color cyl1
    (color:rgb 1 1 0))
;; ()
; Get the color properties of the material.
(material:color-props mat1)
;; (("color" . #[color 1 1 0]))

[Top]


material:color-type

Action
Gets the type of a material's color component.

Filename
scm/scmext/rnd/mclr_scm.cpp

APIs
api_rh_get_color_comp

Syntax
(material:color-type material)

Arg Types
material material

Returns
string

Description
This extension returns the type of color shader assigned to the material as a string.

Arguments
material specifies the color material entity to be inquired.
; material:color-type
; 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 mat1 (material))
;; mat1
; Get the default material color type.
(material:color-type mat1)
;; "plain"
; Set the color type of the material.
(material:set-color-type mat1 "wrapped polka")
;; ()
; Get the color type of the material.
(material:color-type mat1)
;; "wrapped polka"

[Top]


material:color-types

Action
Gets the list of valid color component types.

Filename
scm/scmext/rnd/mclr_scm.cpp

APIs
api_rh_get_color_comp_list

Syntax
(material:color-types)

Arg Types
None

Returns
(string ...)

Description
This extension returns all valid color material types as a string list.

; material:color-types
; Get a list of valid color shader types.
(material:color-types)
;; ("base" "blue marble" "chrome" "cubes" "plain"
;; "marble" "simple wood" "solid clouds"
;; "solid polka" "wrapped brick" "wrapped checker"
;; "wrapped diagonal" "wrapped grid" "wrapped image"
;; "wrapped polka" "wrapped s stripe"
;; "wrapped t stripe" "wrapped textured brick")

[Top]


material:displacement-props

Action
Gets the type of a material's displacement component.

Filename
scm/scmext/rnd/bump_scm.cpp

APIs
api_rh_get_displace_comp

Syntax
(material:displacement-props material)

Arg Types
material material

Returns
((string . integer | real | color) ...)

Description
This extension returns a list containing pairs of the property name and its present value.

Arguments
material specifies the displacement material entity.
; material:displacement-props
; Create a material.
(define mat1 (material))
;; mat1
; Set the displacement type of the material.
(material:set-displacement-type mat1 "casting")
;; ()
; Get the displacement properties of the material.
(material:displacement-props mat1)
;; (("scale" . 1) ("casting amplitude" . 0.05)
;; ("dented amplitude" . 0.5) ("dented scale" . 1)
;; ("dented threshold" . 0.8) ("detail" . 2))

[Top]


material:displacement-status

Action
Gets the on-off status of a material's displacement component.

Filename
scm/scmext/rnd/bump_scm.cpp

APIs
api_rh_get_displace_status

Syntax
(material:displacement-status material)

Arg Types
material material

Returns
boolean

Description
Displacement status is only applicable to Advanced Rendering. Displacement properties cannot be displayed when using Basic Rendering.

Arguments
material specifies the displacement material entity.
; material:displacement-status
; Create a material.
(define mat1 (material))
;; mat1
; Set the displacement type of the material.
(material:set-displacement-type mat1 "casting")
;; ()
; Set the displacement status of the material.
(material:set-displacement-status mat1 #f)
;; ()
; Get the displacement status of the material;
(material:displacement-status mat1)
;; #f

[Top]


material:displacement-type

Action
Gets the type of a material's displacement component.

Filename
scm/scmext/rnd/bump_scm.cpp

APIs
api_rh_get_displace_comp

Syntax
(material:displacement-type material)

Arg Types
material material

Returns
string

Description
This extension returns the type of displacement shader assigned to the material as a string.

Arguments
material specifies the displacement material entity.
; material:displacement-type
; Create a material.
(define mat1 (material))
;; mat1
; Get the displacement type of the material.
(material:displacement-type mat1)
;; "none"
; Set the displacement type of the material.
(material:set-displacement-type mat1 "casting")
;; ()
; Get the displacement type of the material.
(material:displacement-type mat1)
;; "casting"

[Top]


material:displacement-types

Action
Gets the list of valid displacement component types.

Filename
scm/scmext/rnd/bump_scm.cpp

APIs
api_rh_get_displace_comp_list

Syntax
(material:displacement-types)

Arg Types
None

Returns
(string ...)

Description
This extension returns all valid displacement material types as a string list.

; material:displacement-types
; Get the list of valid displacement shader types.
(material:displacement-types)
;; ("casting" "none" "rough" "wrapped bump map"
;; "wrapped dimple" "wrapped knurl" "wrapped rough"
;; "wrapped tread plate")

[Top]


material:reflection-props

Action
Gets the properties of a material's reflection component.

Filename
scm/scmext/rnd/rflt_scm.cpp

APIs
api_rh_get_reflect_comp

Syntax
(material:reflection-props material)

Arg Types
material material

Returns
((string . integer | real | color) ...)

Description
This extension returns a list containing pairs of the property name and its present value.

Arguments
material specifies the reflection material entity.
; material:reflection-props
; Create a material.
(define mat1 (material))
;; mat1
; Get the default reflection shader properties.
(material:reflection-props mat1)
;; (("ambient factor" . 1) ("diffuse factor" . 0.75)
;; ("specular factor" . 0.5) ("exponent" . 10)
;; ("specular color" . #[color 1 1 1]))

[Top]


material:reflection-status

Action
Gets the status of a material's reflection component.

Filename
scm/scmext/rnd/rflt_scm.cpp

APIs
api_rh_get_reflect_status

Syntax
(material:reflection-status material)

Arg Types
material material

Returns
boolean

Description
The extension returns #t for on and #f for off.

Arguments
material specifies the reflection material entity to retrieve the status information.
; material:reflection-status
; Create a material.
(define mat1 (material))
;; mat1
; Get the current reflection status.
(material:reflection-status mat1)
;; #f
; Set the reflection status off.
(material:set-reflection-status mat1 #f)
;; ()
(material:reflection-status mat1)
;; #f

[Top]


material:reflection-type

Action
Gets the type of a material's reflection component.

Filename
scm/scmext/rnd/rflt_scm.cpp

APIs
api_rh_get_reflect_comp

Syntax
(material:reflection-type material)

Arg Types
material material

Returns
string

Description
This extension returns the type of reflection shader assigned to the material as a string.

Arguments
material specifies the reflectance material entity.
; material:reflection-type
; Create a material.
(define mat1 (material))
;; mat1
; Get the default reflection shader type.
(material:reflection-type mat1)
;; "phong"

[Top]


material:reflection-types

Action
Gets the list of valid reflection component types.

Filename
scm/scmext/rnd/rflt_scm.cpp

APIs
api_rh_get_reflect_comp_list

Syntax
(material:reflection-types)

Arg Types
None

Returns
(string ...)

Description
This extension returns all valid reflection material types as a string list.

; material:reflection-types
; Get a list of valid reflection shader types.
(material:reflection-types)
;; ("chrome 2D" "conductor" "constant" "dielectric"
;; "environment" "glass" "matte" "metal" "mirror"
;; "phong" "plastic")

[Top]


material:set-color-type

Action
Sets the type of a material's color component.

Filename
scm/scmext/rnd/mclr_scm.cpp

APIs
api_rh_set_color_comp

Syntax
(material:set-color-type material color-type)

Arg Types
material material
color-type string

Returns
unspecified
Arguments
material specifies the color material entity.

color-type specifies the color type to set to the material entity. The available color types include "base", "blue marble", "chrome", "cubes", "marble", "plain", "simple wood", "solid clouds", "solid polka", "wrapped brick", "wrapped checker", "wrapped diagonal", "wrapped grid", "wrapped image", "wrapped polka", "wrapped s stripe", and "wrapped t stripe".
; material:set-color-type
; material:set-color-type
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 5 30 0) 8))
;; cyl1
; Create a material.
(define mat1 (material))
;; mat1
; Set the color shader type.
(material:set-color-type mat1 "solid polka")
;; ()
; Set the properties of the color shader type.
(material:set-color-prop mat1
    "background color" 5)
;; ()
; Assign the material to the cylinder.
(entity:set-material cyl1 mat1)
;; ()
; Set the appropriate render mode.
(render:set-mode "full")
;; ()
; Render and view the results.
(render)
;; ()
; OUTPUT Example

[Top]


material:set-transparency-prop

Action
Sets a property of a material's transparency component.

Filename
scm/scmext/rnd/trsp_scm.cpp

APIs
api_rh_get_transp_comp, api_rh_set_transp_arg

Syntax
(material:set-transparency-prop material name value)

Arg Types
material material
name string
value real | color

Returns
unspecified
Arguments
material specifies a transparency material entity.

name specifies the property name to attach to the material entity. value specifies the value associated with the property name. The following property names are available.

Note:
Only transparency property names and values associated with a specific material entity can be set.

"base" copies the input transparency to the output transparency. The input transparency is available if transparencies are assigned to the vertices of polygonal geometry. If transparencies are not available at vertices, the input transparency is black, implying that the surface is opaque. It depends on data generated by the faceter.

"eroded" creates the illusion of erosion on a surface. The default values are:
scale 1.0 (real)
coverage 0.5 (real)
fuzz 0.1 (real)

"None" No transparency (opaque).

"plain" provides a plain, uniform transparency. The transparency is specified as a color filter value by color. This simulates colored transparency and translucency, such as colored glass. The default values are:
color #[color 1 1 1]

"wrapped grid" provides a grid pattern in texture-space. The grid appears opaque with holes visible between the grid lines. The default values are:
scale 1.0 (real)
width 0.8 (real)
height 0.8 (real)
grid size 0.2 (real)
transparency 0.0 (real)

"wrapped image" provides image mapping for transparency shading. The name of the file containing the image data is provided as a string to filename. The default values are:
filename string
; material:set-transparency-prop
; Create a material.
(define mat1 (material))
;; mat1
; Set the reflection shader type.
(material:set-transparency-type mat1
    "wrapped grid")
;; ()
; Set the property of the reflection shader type.
(material:set-transparency-prop mat1
    "grid size" 0.3)
;; ()
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 5 30 0) 8))
;; cyl1
; Assign the material to the cylinder.
(entity:set-material cyl1 mat1)
;; ()
; Set the appropriate render mode.
(render:set-mode "full")
;; ()
; Render and view the results.
(render)
;; ()
; OUTPUT Example

Figure. material:set-transparency-prop

[Top]


material:set-transparency-status

Action
Sets the status of a material's transparency component.

Filename
scm/scmext/rnd/trsp_scm.cpp

APIs
api_rh_set_transp_status

Syntax
(material:set-transparency-status material status=#t)

Arg Types
material material
status boolean

Returns
unspecified
Arguments
material specifies the transparency material entity.

status specifies either to enable (#t) or disable (#f) the transparency. When enabled, it displays the material's transparency properties.
; material:set-transparency-status
; Create a material.
(define mat1 (material))
;; mat1
; Set the transparency shader status on.
(material:set-transparency-status mat1 #t)
;; ()

[Top]


material:set-transparency-type

Action
Sets the type of a material's transparency component.

Filename
scm/scmext/rnd/trsp_scm.cpp

APIs
api_rh_set_transp_comp

Syntax
(material:set-transparency-type material transparency-type)

Arg Types
material material
transparency-type string

Returns
unspecified
Arguments
material specifies the transparency material entity.

transparency-type
specifies the desired transparency material type. The available transparency types are: "base", "eroded", "None", "plain", "wrapped grid", and "wrapped image".
; material:set-transparency-type
; Create a material.
(define mat1 (material))
;; mat1
; Set the reflection shader type.
(material:set-transparency-type mat1
    "wrapped grid")
;; ()
; Create a solid cylinder.
(define cyl1
    (solid:cylinder (position 0 0 0)
    (position 5 30 0) 8))
;; cyl1
; Assign the material to the cylinder.
(entity:set-material cyl1 mat1)
;; ()
; Set the appropriate render mode.
(render:set-mode "full")
;; ()
; Render and view the results.
(render)
;; ()
; OUTPUT Example

Figure. material:set-transparency-type

[Top]


material:transparency-props

Action
Gets the properties of a material's transparency component.

Filename
scm/scmext/rnd/trsp_scm.cpp

APIs
api_rh_get_transp_comp

Syntax
(material:transparency-props material)

Arg Types
material material

Returns
((string . integer | real | color) ...)

Description
This extension returns a list containing pairs of the property name and its present value.

Arguments
material specifies the transparency material entity.
; material:transparency-props
; Create a material.
(define mat1 (material))
;; mat1
; Set the type of transparency for the material.
(material:set-transparency-type mat1
    "wrapped grid")
;; ()
; Get the properties of the transparency type.
(material:transparency-props mat1)
;; (("scale" . 1) ("width" . 0.8) ("height" . 0.8)
;; ("grid size" . 0.2) ("transparency" . 0))

[Top]


material:transparency-status

Action
Gets the status of a material's transparency component.

Filename
scm/scmext/rnd/trsp_scm.cpp

APIs
api_rh_get_transp_status

Syntax
(material:transparency-status material)

Arg Types
material material

Returns
boolean

Description
The extension returns #t for on and #f for off.

Arguments
material specifies the transparency material entity to retrieve the status information.
; material:transparency-status
; Create a material.
(define mat1 (material))
;; mat1
; Get the current transparency status.
(material:transparency-status mat1)
;; #f
; Set the transparency status off.
(material:set-transparency-status mat1 #f)
;; ()
(material:transparency-status mat1)
;; #f

[Top]


material:transparency-type

Action
Gets the type of a material's transparency component.

Filename
scm/scmext/rnd/trsp_scm.cpp

APIs
api_rh_get_transp_comp

Syntax
(material:transparency-type material)

Arg Types
material material

Returns
string

Description
This extension returns the type of transparency shader assigned to the material as a string.

Arguments
material specifies the transparency material entity.
; material:transparency-type
; Create a material.
(define mat1 (material))
;; mat1
; Get the default transparency type.
(material:transparency-type mat1)
;; "none"

[Top]


material:transparency-types

Action
Gets a list of valid transparency component types.

Filename
scm/scmext/rnd/trsp_scm.cpp

APIs
api_rh_get_transp_comp_list

Syntax
(material:transparency-types)

Arg Types
None

Returns
(string ...)

Description
This extension returns all valid transparency material types as a string list.

; material:transparency-types
; Get a list of all valid transparency shaders.
(material:transparency-types)
;; ("base" "eroded" "none" "plain" "wrapped grid"
;; "wrapped image")

[Top]


material?

Action
Determines if a Scheme object is a material.

Filename
scm/scmext/rnd/mat_scm.cpp

APIs
None

Syntax
(material? object)

Arg Types
object scheme-object

Returns
boolean

Description
This extension returns #t if the object is a material; otherwise, it returns #f.

Arguments
object specifies the scheme-object that has to be queried for a material.
; material?
; Create a material.
(define mat1 (material))
;; mat1
; Determine if the object is actually a material.
(material? mat1)
;; #t

[Top]


render:set-default-color-type

Action
Sets the default color type for newly created materials.

Filename
scm/scmext/rnd/mclr_scm.cpp

APIs
api_rh_def_color_comp

Syntax
(render:set-default-color-type color-type)

Arg Types
color-type string

Returns
unspecified
Arguments
color-type specifies the color type to set to the material entity. The available color types include "base", "blue marble", "chrome", "cubes", "marble", "plain", "simple wood", "solid clouds", "solid polka", "wrapped brick", "wrapped checker", "wrapped diagonal", "wrapped grid", "wrapped image", "wrapped polka", "wrapped s stripe", and "wrapped t stripe".
; render:set-default-color-type
; Set the default color shader type.
(render:set-default-color-type "blue marble")
;; ()

[Top]


texture-space

Action
Creates a texture space.

Filename
scm/scmext/rnd/tmap_scm..cpp

APIs
api_rh_create_texture_space

Syntax
(texture-space type)

Arg Types
type string

Returns
texture-space

Description
Texture space controls how a a wrapped material entity is applied to a face or solid body. A texture space is applied to an entity using entity:set-texture-space.

The Advanced Rendering Component is required to display texture space on wrapped materials. However, in the Basic Rendering Component, the texture space may be created, its properties changed, and the texture space entity associated with a model entity. However, Basic Rendering Component does not display the results.

Arguments
type is a string specifying the texture space type. The available texture space types include "arbitrary plane", "auto axis", "cylindrical", "spherical", "uv", "x plane", "y plane", and "z plane".
; texture-space
; Create a solid block.
(define block1 (solid:block
    (position 0 0 0) (position 5 10 16)))
;; block1
; Create a solid sphere.
(define sphere1 (solid:sphere
    (position -10 -10 -10) 10))
;; sphere1
; Create two texture spaces.
(define texture1 (texture-space "auto axis"))
;; texture1
(define texture2 (texture-space "spherical"))
;; texture2
; Set the textures onto the solids.
(entity:set-texture-space block1 texture1)
;; ()
(entity:set-texture-space sphere1 texture2)
;; ()

[Top]


texture-space:props

Action
Gets the properties of a texture space.

Filename
scm/scmext/rnd/tmap_scm..cpp

APIs
api_rh_get_texture_space_args

Syntax
(texture-space:props texture-space)

Arg Types
texture-space texture-space

Returns
((string . real | integer | gvector) ...)

Description
This extension returns a list containing pairs of the property type and their current values.

The Advanced Rendering Component is required to display texture space on wrapped materials. However, in the Basic Rendering Component, the texture space may be created, its properties changes, and the texture space entity associated with a model entity. However, Basic Rendering Component does not display the results.

Arguments
texture-space specifies a texture space to be queried.
; texture-space:props
; Create a texture space.
(define texture1 (texture-space "auto axis"))
;; texture1
; Get the properties of the texture space.
(texture-space:props texture1)
;; (("scale" . 1))

[Top]


texture-space:set-prop

Action
Sets a property of a texture space.

Filename
scm/scmext/rnd/tmap_scm..cpp

APIs
api_rh_get_texture_space_args, api_rh_set_texture_space_arg

Syntax
(texture-space:set-prop texture-space name value)

Arg Types
texture-space entity
name string
value integer | real | gvector

Returns
unspecified

Description
Texture space controls how a a wrapped material entity is applied to a face or solid body. A texture space is applied to an entity using entity:set-texture-space.

The Advanced Rendering Component is required to display texture space on wrapped materials. However, in the Basic Rendering Component, the texture space may be created, its properties changes, and the texture space entity associated with a model entity. However, Basic Rendering Component does not display the results.

Arguments
texture-space specifies the texture space entity.

name specifies the texture space property name. value specifies the value of the associated property name. The properties are:

"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]

"arbitrary plane" is point mapping onto an arbitrary plane. The default values are:
scale 1.0 (real)
aspect ratio 1.0 (real)
origin #[gvector 0 0 0]
normal vector #[gvector 0 0 1]
up vector #[gvector 0 1 0]

"auto axis" is point mapping by one of the three coordinate axes (x, y, and z axes).

"cylindrical" is point mapping onto a cylinder. The default values are:
scale around axis 1.0 (real)
scale along axis 1.0 (real)
centre point #[gvector 0 0 0]
axis direction #[gvector 0 0 1]
origin #[gvector 1 0 0]

"spherical" is point mapping onto a sphere. The default values are:
latitude scale 1.0 (real)
longitude scale 1.0 (real)
centre point #[gvector 0 0 0]
origin #[gvector 1 0 0]
axis direction #[gvector 0 0 1]

"uv" maps parametric coordinate system to the texture space. The default values are:
u scale 1.0 (real)
v scale 1.0 (real)

"x plane" provides point mapping onto a plane of constant x. The default value is:
scale 1.0 (real)

"y plane" provides point mapping onto a plane of constant y. The default value is:
scale 1.0 (real)

"z plane" provides point mapping onto a plane of constant z. The default value is:
scale 1.0 (real)
; texture-space:set-prop
; Get a list of valid texture space shader types.
(texture-space:types)
;; ("arbitrary plane" "auto axis" "cylindrical"
;; "spherical" "uv" "x plane" "y plane" "z plane")
; Create a texture space.
(define texture1 (texture-space "arbitrary plane"))
;; texture1
; Set a property of the texture space.
(texture-space:set-prop texture1
    "aspect ratio" 0.75)
;; ()

[Top]


texture-space:type

Action
Gets the type of a texture space.

Filename
scm/scmext/rnd/tmap_scm..cpp

APIs
api_rh_get_texture_space_args

Syntax
(texture-space:type texture-space)

Arg Types
texture-space texture-space

Returns
string
Arguments
texture-space specifies a texture space to be queried.
; texture-space:type
; Get a list of valid texture space shader types.
(texture-space:types)
;; ("arbitrary plane" "auto axis" "cylindrical"
;; "spherical" "uv" "x plane" "y plane" "z plane")
; Create a texture space.
(define texture1 (texture-space "auto axis"))
;; texture1
; Get the type of texture space.
(texture-space:type texture1)
;; "auto axis"

[Top]


texture-space:types

Action
Gets a list of valid texture space types.

Filename
scm/scmext/rnd/tmap_scm..cpp

APIs
api_rh_get_texture_space_types

Syntax
(texture-space:types)

Arg Types
None

Returns
(string ...)

Description
This extension returns all valid texture space types in a list of strings.

The Advanced Rendering Component is required to display texture space on wrapped materials. However, in the Basic Rendering Component, the texture space may be created, its properties changes, and the texture space entity associated with a model entity. However, Basic Rendering Component does not display the results.

; texture-space:types
; Get a list of valid texture space shader types.
(texture-space:types)
;; ("arbitrary plane" "auto axis" "cylindrical"
;; "spherical" "uv" "x plane" "y plane" "z plane")

[Top]


texture-space?

Action
Determines if a Scheme object is a texture space.

Filename
scm/scmext/rnd/tmap_scm..cpp

APIs
None

Syntax
(texture-space? object)

Arg Types
object scheme-object

Returns
boolean
Arguments
object specifies the scheme-object that has to be queried for a texture space.
; texture-space?
; Create a texture space.
(define texture1 (texture-space "auto axis"))
;; texture1
; Determine if the texture space is actually
; a texture space.
(texture-space? texture1)
;; #t

[Top]