Version 0.60.0
open

material

A surface material.

Signatures

  •   material( int mat_code )
  •   material( int mat_code, color diff_color )

Details

Materials are defined by their material code, and their diffusive color.

Materials can be casted to modifiers and can thus be applied to solids accordingly.

Remark

Some materials (like gold) have a diffusive color on their own that cannot be changed. The diff_color parameter will be ignorde by these.

Material type setting

The material type is defined by the integral value mat_code. The actual attribution of its value to a certain material depends on the visualization type that is chosen for displaying the model (e.g. the trCAD online editor or paramate visualizers).

Although the material code can be provided as simple number, this is not recommended since the numerical value may change in further versions of the system. Instead it is recommended to import package "materials.sps" and use the material enumerations provided there (see the materials documentation).

Example

 #import ( "std/materials.sps" )
 enum mat_codes = materials::materials

 make material( mat_codes::DIELECTRIC, rgb( 255,0,255 ) ) >> torus()
 

Casts To

string
modifier

Optional Open Parameter Attributes

bool readonly

Tells the user interface or frontend to disable the setting of the open parameter.

string style

Specifies some limited styling instructions for the user interface or frontend.

int expose_opar

Controls the visibility state of the open parameter. Possible values are -1 (do not expose), 0 (expose when requested) and +1 (expose).

material[] options

An array of material values that defines a selection of allowed values. The user interface or frontend may use a drop-down list to display this open parameter's control. The system enforces that the open parameter value is of the selection options.

string[] options_texts

This attribute requires an options attribute to be present. The options_texts attribute is an array of string values that should ideally have the same length as the options array. Its function is to provide a short name or description for each of the options values. These may be used in the drop-down list by the user interface or frontend.

Parameters

mat_code

Integral code value defining the material type.

diff_color

The diffusive color of the material. See data type color.

See also

🗙

Search results for