Sets properties of a material in the material database. This command can only edit the properties of the materials that are NOT write protected.
Supported Product: FDTD, MODE
Displays the property names of the specified material that can be modified.
setmaterial( "materialname", "propertyname", newvalue);
Sets the property named "propertyname" of the material with the name "materialname" to newvalue. The argument newvalue can be a number or a string. The arguments "propertyname" and "materialname" have to match correct string exactly. For example,
will set the property "mesh order" of the materials "Si" to 4.
This example adds a new Conductive material, set the name to "myMaterial", anisotropy to "Diagonal", and set the permittivity as well as conductivity properties for the material.
temp = addmaterial("Conductive");
setmaterial("myMaterial", "Anisotropy", 1); # enable diagonal anisotropy
This example shows how to create a new Sampled data material.
Note: Sampled data matrix format
The sampled data matrix must have 2 or 4 rows, for isotropic or anisotropic materials
- The first column is the frequency vector, in Hz.
- The next column(s) are the complex valued permittivity.
If you have refractive index data (rather than permittivity), remember that permittivity is simply the square of the refractive index.
f = linspace(1000e12,300e12,30); # frequency vector
eps = 2 + 1i*(1e6 / (2*pi*f*eps0)); # create example permittivity vector
sampledData = [f,eps]; # collect f and eps in one matrix
matName = "My material";
temp = addmaterial("Sampled data");
setmaterial(temp,"name",matName); # rename material
setmaterial(matName,"max coefficients",2); # set the number of coefficients
setmaterial(matName,"sampled data",sampledData); # load the sampled data matrix
It is possible to define the color of the material using command lines. Here is an example, open a brand new project file, enter these command lines and it will create a material, define the color and assign that material to a rectangle to show you the color change. The 4 elements are for red, green, blue, alpha channel. These elements can be set between 0 to 1, which represents a minimum of 0 and maximum of 255 . Alpha defines the opacity, setting ti to 0 means transparent, 1 means a solid color. Note that the opacity can be also defined in the structure object, by overriding the material properties.
mymaterial = addmaterial("PEC");
setmaterial("test_material", "color", [1; 0.6; 0.4; 0.3] ); # R, G, B, alpha channel
set("override color opacity from material database", 0);