Material class

The Material class gives you access to material cards in PRIMER. More...

The PRIMER JavaScript API provides many class constants, properties and methods. For Arup to be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:

Class functions

Member functions

Material properties

Name Type Description
addDamageGissmo logical True if *MAT_ADD_DAMAGE_GISSMO exists for material, false if not defined
addErosion logical True if *MAT_ADD_EROSION exists for material, false if not defined
addKeywords (read only) integer The number of extra *MAT_ADD_xxxx keywords that this material definition has. Note that if there is only a single *MAT_ADD_xxxx keyword for an ID this will be 0. For example, if for material 1 both a *MAT_PIECEWISE_LINEAR_PLASTICITY card and a *MAT_ADD_EROSION card exist then this will return 1. If for material 2 only a *MAT_ADD_EROSION card exists then this will return 0. Also see Material.Keyword() and Material.KeywordCards()
colour Colour The colour of the material
cols (read only) real The number of columns of data the material has
exists (read only) logical true if material exists, false if referred to but not defined.
include integer The Include file number that the material is in.
label integer or string Material number or character label. Also see the mid property which is an alternative name for this.
mid integer or string Material number or character label. Also see the label property which is an alternative name for this.
model (read only) integer The Model number that the material is in.
optionalCards (read only) integer The number of optional extra cards that this material definition can have. Also see Material.AddOptionalCards()
properties integer The total number of properties that the material has
rows (read only) integer The number of rows of data the material has
title string Material title
transparency integer The transparency of the material (0-100) 0% is opaque, 100% is transparent.
type string The material type name(e.g. 'ELASTIC', 'RIGID' etc).
typeNumber string The material type number (e.g. '001', '034M').

Detailed Description

The Material class allows you to create, modify, edit and manipulate material cards. See the documentation below for more details.

Constructor

new Material(Model[Model], mid[integer or string], type[string])

Description

Create a new Material object.

Arguments

  • Model (Model)

    Model that material will be created in

  • mid (integer or string)

    Material number or character label

  • type (string)

    Material type. Either give the Ansys LS-DYNA material name or 3 digit number.

    Returns

    Material object

    Return type

    Material

    Example

    To create a new rigid material in model m with label 100

    var mat = new Material(m, 100, "RIGID");

    or

    var mat = new Material(m, 100, "020");

    or

    var mat = new Material(m, 100, "*MAT_RIGID");

    or

    var mat = new Material(m, 100, "*MAT_020");

    Details of functions

    AddOptionalCards()

    Description

    Adds any optional cards for the material.
    Some materials have extra optional cards in the input. If they are there Ansys LS-DYNA will read them but they are not required input. For example a material could have three required cards and one extra optional card. If PRIMER reads this material from a keyword file and it only has the three required cards then the properties in the material will only be defined for those cards. i.e. there will not be any properties in the material for the extra optional line.
    If you edit the material interactively in PRIMER then the extra optional card will be shown so you can add values if required. When writing the material to a keyword file the extra optional card will be omitted if none of the fields are used.
    If you want to add one of the properties for the extra optional card in JavaScript this method will ensure that the extra card is defined and the properties added to the material as zero values. You can then use Material.SetPropertyByIndex(), Material.SetPropertyByName() or Material.SetPropertyByRowCol() as normal to set the properties. Also see the optionalCards property.

    Arguments

    No arguments

    Returns

    no return value

    Example

    To add any optional cards for material m:

    m.AddOptionalCards();


    AssociateComment(Comment[Comment])

    Description

    Associates a comment with a material.

    Arguments

  • Comment (Comment)

    Comment that will be attached to the material

    Returns

    No return value

    Example

    To associate comment c to the material m:

    m.AssociateComment(c);


    Blank()

    Description

    Blanks the material

    Arguments

    No arguments

    Returns

    No return value

    Example

    To blank material m:

    m.Blank();


    BlankAll(Model[Model], redraw (optional)[boolean]) [static]

    Description

    Blanks all of the materials in the model.

    Arguments

  • Model (Model)

    Model that all materials will be blanked in

  • redraw (optional) (boolean)

    If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().

    Returns

    No return value

    Example

    To blank all of the materials in model m:

    Material.BlankAll(m);


    BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]

    Description

    Blanks all of the flagged materials in the model.

    Arguments

  • Model (Model)

    Model that all the flagged materials will be blanked in

  • flag (Flag)

    Flag set on the materials that you want to blank

  • redraw (optional) (boolean)

    If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().

    Returns

    No return value

    Example

    To blank all of the materials in model m flagged with f:

    Material.BlankFlagged(m, f);


    Blanked()

    Description

    Checks if the material is blanked or not.

    Arguments

    No arguments

    Returns

    true if blanked, false if not.

    Return type

    Boolean

    Example

    To check if material m is blanked:

    if (m.Blanked() ) do_something...


    Browse(modal (optional)[boolean])

    Description

    Starts an edit panel in Browse mode.

    Arguments

  • modal (optional) (boolean)

    If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal.

    Returns

    no return value

    Example

    To Browse material m:

    m.Browse();


    ClearFlag(flag[Flag])

    Description

    Clears a flag on the material.

    Arguments

  • flag (Flag)

    Flag to clear on the material

    Returns

    No return value

    Example

    To clear flag f for material m:

    m.ClearFlag(f);


    Copy(range (optional)[boolean])

    Description

    Copies the material. The target include of the copied material can be set using Options.copy_target_include.

    Arguments

  • range (optional) (boolean)

    If you want to keep the copied item in the range specified for the current include. Default value is false. To set current include, use Include.MakeCurrentLayer().

    Returns

    Material object

    Return type

    Material

    Example

    To copy material m into material z:

    var z = m.Copy();


    Create(Model[Model], modal (optional)[boolean]) [static]

    Description

    Starts an interactive editing panel to create a material

    Arguments

  • Model (Model)

    Model that the material will be created in.

  • modal (optional) (boolean)

    If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal.

    Returns

    Material object (or null if not made).

    Return type

    Material

    Example

    To start creating a material in model m:

    var m = Material.Create(m);


    Density()

    Description

    Get the density material.

    Arguments

    No arguments

    Returns

    real

    Return type

    Number

    Example

    To get the density for material m:

    var density = m.Density();


    DetachComment(Comment[Comment])

    Description

    Detaches a comment from a material.

    Arguments

  • Comment (Comment)

    Comment that will be detached from the material

    Returns

    No return value

    Example

    To detach comment c from the material m:

    m.DetachComment(c);


    Edit(modal (optional)[boolean])

    Description

    Starts an interactive editing panel.

    Arguments

  • modal (optional) (boolean)

    If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal.

    Returns

    no return value

    Example

    To Edit material m:

    m.Edit();


    Error(message[string], details (optional)[string])

    Description

    Adds an error for material. For more details on checking see the Check class.

    Arguments

  • message (string)

    The error message to give

  • details (optional) (string)

    An optional detailed error message

    Returns

    No return value

    Example

    To add an error message "My custom error" for material m:

    m.Error("My custom error");


    ExtractColour()

    Description

    Extracts the actual colour used for material.
    By default in PRIMER many entities such as elements get their colour automatically from the part that they are in. PRIMER cycles through 13 default colours based on the label of the entity. In this case the material colour property will return the value Colour.PART instead of the actual colour. This method will return the actual colour which is used for drawing the material.

    Arguments

    No arguments

    Returns

    colour value (integer)

    Return type

    Number

    Example

    To return the colour used for drawing material m:

    var colour = m.ExtractColour();


    First(Model[Model]) [static]

    Description

    Returns the first material in the model.

    Arguments

  • Model (Model)

    Model to get first material in

    Returns

    Material object (or null if there are no materials in the model).

    Return type

    Material

    Example

    To get the first material in model m:

    var m = Material.First(m);


    FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]

    Description

    Returns the first free material label in the model. Also see Material.LastFreeLabel(), Material.NextFreeLabel() and Model.FirstFreeItemLabel().

    Arguments

  • Model (Model)

    Model to get first free material label in

  • layer (optional) (Include number)

    Include file (0 for the main file) to search for labels in (Equivalent to First free in layer in editing panels). If omitted the whole model will be used (Equivalent to First free in editing panels).

    Returns

    Material label.

    Return type

    Number

    Example

    To get the first free material label in model m:

    var label = Material.FirstFreeLabel(m);


    FlagAll(Model[Model], flag[Flag]) [static]

    Description

    Flags all of the materials in the model with a defined flag.

    Arguments

  • Model (Model)

    Model that all materials will be flagged in

  • flag (Flag)

    Flag to set on the materials

    Returns

    No return value

    Example

    To flag all of the materials with flag f in model m:

    Material.FlagAll(m, f);


    Flagged(flag[Flag])

    Description

    Checks if the material is flagged or not.

    Arguments

  • flag (Flag)

    Flag to test on the material

    Returns

    true if flagged, false if not.

    Return type

    Boolean

    Example

    To check if material m has flag f set on it:

    if (m.Flagged(f) ) do_something...


    ForEach(Model[Model], func[function], extra (optional)[any]) [static]

    Description

    Calls a function for each material in the model.
    Note that ForEach has been designed to make looping over materials as fast as possible and so has some limitations.
    Firstly, a single temporary Material object is created and on each function call it is updated with the current material data. This means that you should not try to store the Material object for later use (e.g. in an array) as it is temporary.
    Secondly, you cannot create new materials inside a ForEach loop.

    Arguments

  • Model (Model)

    Model that all materials are in

  • func (function)

    Function to call for each material

  • extra (optional) (any)

    An optional extra object/array/string etc that will appended to arguments when calling the function

    Returns

    No return value

    Example

    To call function test for all of the materials in model m:

    Material.ForEach(m, test);
    function test(m)
    {
    // m is Material object
    }

    To call function test for all of the materials in model m with optional object:

    var data = { x:0, y:0 };
    Material.ForEach(m, test, data);
    function test(m, extra)
    {
    // m is Material object
    // extra is data
    }


    GetAddDamageGissmoData()

    Description

    Returns the *MAT_ADD_DAMAGE_GISSMO data of material.

    Arguments

    No arguments

    Returns

    Object with the following properties:

    Name Type Description
    biaxf real Reduction factor for regularization at triaxiality=2/3
    dcrit real Damage treshold value
    dmgexp real Exponent for nonlinear damage accumalation
    dtyp real Flag for GISSMO damage type
    ecrit real/integer Critical plastic strain (Curve/ table ID if negative)
    fadexp real/integer Exponent for damage-related stress fadeout (Curve/ table ID if negative)
    hisvn real History variable used to evaluate th 3-D table LCSDG
    instf integer Flag for governing the behavior of instability measure F and fading exponent FADEXP
    lcdlim integer Curve ID: damage limit values as a function of triaxiality
    lcregd integer Curve/ table ID (positive) or Table ID (negative): Element-size dependent fading exponent
    lcsdg integer Curve/ table ID (positive) or Function ID (negative): Failure strain curve/table or function
    lcsoft integer Soft reduction factor for failure strain in crashfront elements.
    lcsrs integer Curve/ table ID: Failure strain rate scaling factor v/s strain rate
    lp2bi real Option to use bending indicator instead of the Lode parameter
    midfail integer Mid-plane failure option for shell elements and GISSMO
    numfip real Number of failed integration points prior to element deletion
    refsz real Reference element size
    rgtr1 real First triaxiality value for optional "tub-shaped" regularization
    rgtr2 real Second triaxiality value for optional "tub-shaped" regularization
    shrf real Reduction factor for regularization at triaxiality=0
    soft real Softening reduction factor for failure strain in crashfront elements
    stochastic logical stochastic = true if _STOCHASTIC is ON. Otherwise, _STOCHASTIC is OFF
    volfrac real Volume fraction required to fail before element deletion

    Return type

    object

    Example

    To get the *MAT_ADD_DAMAGE_GISSMO data of material m:

    m.GetAddDamageGissmoData();


    GetAddErosionData()

    Description

    Returns the *MAT_ADD_EROSION data of material. Note that this method does not support pre-R11 properties.

    Arguments

    No arguments

    Returns

    Object with the following properties:

    Name Type Description
    dteflt real Time period for the low pass filter
    dtmin real Minimum time step size at failure
    effeps real Maximum effective strain at failure
    engcrt real Critical energy for nonlocal failure criterion
    epssh real Shear strain at failure
    epsthin real Thinning strain at failure for shells
    excl real The exclusion number
    failtm real Failure time
    idam integer Flag for damage model
    impulse real Stress impulse for failure
    lceps12 integer Load curve ID defining in-plane shear strain limit vs elem size
    lceps13 integer Load curve ID defining through-thickness shear strain limit vs elem size
    lcepsmx integer Load curve ID defining in-plane major strain limit vs elem size
    lcfld integer Curve (negative) or table (positive) ID: Forming limit diagram
    lcregd integer Curve ID: Element-size dependent fading exponent
    mneps real Minimum principal strain at failure
    mnpres real Pressure at failure
    mxeps real/integer Principal strain at failure (curve ID if negative)
    mxpres real Maximum pressure at failure
    mxtmp real Maximum temperature at failure
    ncs real Number of failure conditions to satisfy before failure occurs
    nsff real Number of explicit time step cycles for stress fade-out used in the LCFLD criterion
    numfip real Number of failed integration points prior to element deletion
    radcrt real Critical radius for nonlocal failure criterion
    sigp1 real Principal stress at failure
    sigth real Threshold stress
    sigvm real/integer Equivalent stress at failure (curve ID if negative)
    voleps real Volumetric strain at failure
    volfrac real The volume fraction required to fail before the element is deleted

    Return type

    object

    Example

    To get the *MAT_ADD_EROSION data of material m:

    m.GetAddErosionData();


    GetAll(Model[Model], property (optional)[string]) [static]

    Description

    Returns an array of Material objects or properties for all of the materials in a model in PRIMER. If the optional property argument is not given then an array of Material objects is returned. If the property argument is given, that property value for each material is returned in the array instead of a Material object

    Arguments

  • Model (Model)

    Model to get materials from

  • property (optional) (string)

    Name for property to get for all materials in the model

    Returns

    Array of Material objects or properties

    Return type

    Array

    Example

    To make an array of Material objects for all of the materials in model m:

    var a = Material.GetAll(m);

    To return an array containing the value of property 'foo' (for example 'x' for a node) for each material in model m:

    var a = Material.GetAll(m, 'foo');


    GetComments()

    Description

    Extracts the comments associated to a material.

    Arguments

    No arguments

    Returns

    Array of Comment objects (or null if there are no comments associated to the node).

    Return type

    Array

    Example

    To get the array of comments associated to the material m:

    var comm_array = m.GetComments();


    GetErosionPropertyByName(acronym[string], idam_index (optional)[integer])   [deprecated]

    This function is deprecated in version 20.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Returns the value of Erosion property string acronym for this Material object or null if Erosion is not set on Material or no such Erosion property exists.

    Arguments

  • acronym (string)

    The acronym of the Erosion property value to retrieve

  • idam_index (optional) (integer)

    Required if property is one of IDAM cards pair property (for IDAM value less than zero) . If the argument is not given, returns the property value for first IDAM cards Pair. The index value starts from zero.

    Returns

    Property value (real/integer)

    Return type

    Number

    Example

    To return the value of IDAM for material m:

    var idam = m.GetErosionPropertyByName("IDAM");
    


    GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]

    Description

    Returns an array of Material objects for all of the flagged materials in a model in PRIMER If the optional property argument is not given then an array of Material objects is returned. If the property argument is given, then that property value for each material is returned in the array instead of a Material object

    Arguments

  • Model (Model)

    Model to get materials from

  • flag (Flag)

    Flag set on the materials that you want to retrieve

  • property (optional) (string)

    Name for property to get for all flagged materials in the model

    Returns

    Array of Material objects or properties

    Return type

    Array

    Example

    To make an array of Material objects for all of the materials in model m flagged with f:

    var m = Material.GetFlagged(m, f);

    To return an array containing the value of property 'foo' (for example 'x' for a node) for all of the materials in model m flagged with f:

    var a = Material.GetFlagged(m, f, 'foo');


    GetFromID(Model[Model], number[integer]) [static]

    Description

    Returns the Material object for a material ID.

    Arguments

  • Model (Model)

    Model to find the material in

  • number (integer)

    number of the material you want the Material object for

    Returns

    Material object (or null if material does not exist).

    Return type

    Material

    Example

    To get the Material object for material 100 in model m

    var m = Material.GetFromID(m, 100);


    GetMaterialErosionExists()   [deprecated]

    This function is deprecated in version 20.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Checks if the Erosion properties are defined for this Material object.

    Arguments

    No arguments

    Returns

    logical

    Return type

    Boolean

    Example

    To get whether the Material has Erosion Properties:

    m.GetMaterialErosionExists();
    


    GetParameter(prop[string])

    Description

    Checks if a Material property is a parameter or not. Note that object properties that are parameters are normally returned as the integer or float parameter values as that is virtually always what the user would want. For this function to work the JavaScript interpreter must use the parameter name instead of the value. This can be done by setting the Options.property_parameter_names option to true before calling the function and then resetting it to false afterwards.. This behaviour can also temporarily be switched by using the Material.ViewParameters() method and 'method chaining' (see the examples below).

    Arguments

  • prop (string)

    material property to get parameter for

    Returns

    Parameter object if property is a parameter, null if not.

    Return type

    Parameter

    Example

    To check if Material property m.example is a parameter:

    Options.property_parameter_names = true;
    if (m.GetParameter(m.example) ) do_something...
    Options.property_parameter_names = false;

    To check if Material property m.example is a parameter by using the GetParameter method:

    if (m.ViewParameters().GetParameter(m.example) ) do_something...


    GetPropertyByIndex(index[integer])

    Description

    Returns the value of property at index index for this Material object or null if no property exists.

    Arguments

  • index (integer)

    The index of the property value to retrieve. (the number of properties can be found from properties) Note that indices start at 0. There is no link between indices and rows/columns so adjacent fields on a line for a material may not have adjacent indices.

    Returns

    Property value (real/integer)

    Return type

    Number

    Example

    To return the property at index 2, for material m:

    var prop = m.GetPropertyByIndex(2);
    


    GetPropertyByName(acronym[string])

    Description

    Returns the value of property string acronym for this Material object or null if no property exists.

    Arguments

  • acronym (string)

    The acronym of the property value to retrieve

    Returns

    Property value (real/integer)

    Return type

    Number

    Example

    To return the value of RO for material m:

    var ro = m.GetPropertyByName("RO");
    


    GetPropertyByRowCol(row[integer], col[integer])

    Description

    Returns the value of the property for row and col for this Material object or null if no property exists. Note that rows and columns start at 0.

    Arguments

  • row (integer)

    The row of the property value to retrieve

  • col (integer)

    The column of the property value to retrieve

    Returns

    Property value (real/integer)

    Return type

    Number

    Example

    To return the value of the property at row 0, column 1 for material m:

    var prop = m.GetPropertyByRowCol(0, 1);
    


    GetPropertyNameForIndex(index[integer])

    Description

    Returns the name of the property at index index for this Material object or null if there is no property.

    Arguments

  • index (integer)

    The index of the property name to retrieve. (the number of properties can be found from properties) Note that indices start at 0. There is no link between indices and rows/columns so adjacent fields on a line for a material may not have adjacent indices.

    Returns

    Property name (string)

    Return type

    String

    Example

    To return the name of the property at index 2, for material m:

    var name = m.GetPropertyNameForIndex(2);
    


    GetPropertyNameForRowCol(row[integer], col[integer])

    Description

    Returns the name of the property at row and col for this Material object or null if there is no property. Note that rows and columns start at 0.

    Arguments

  • row (integer)

    The row of the property name to retrieve

  • col (integer)

    The column of the property name to retrieve

    Returns

    Property name (string)

    Return type

    String

    Example

    To return the name of the property at row 0, column 1 for material m:

    var name = m.GetPropertyNameForRowCol(0, 1);
    


    Keyword(index (optional)[integer])

    Description

    Returns the keyword for this material (e.g. *MAT_RIGID, *MAT_ELASTIC etc). Note that a carriage return is not added. See also Material.KeywordCards()

    Arguments

  • index (optional) (integer)

    If this argument is not given then the material keyword is returned as normal. However if the material also has *MAT_ADD_xxxx cards defined for it (e.g. *MAT_ADD_EROSION) then the index can be used to return the title for the *MAT_ADD card instead. The index value starts from zero. The number of *MAT_ADD cards can be found from the addKeywords property

    Returns

    string containing the keyword.

    Return type

    String

    Example

    To get the keyword for material m:

    var key = m.Keyword();

    To print all of the keywords and keyword cards for any *MAT_ADD cards for material m:

    for (i=0; i<m.addKeywords; i++)
    {
        Message(m.Keyword(i));
        Message(m.KeywordCards(i));
    }


    KeywordCards(index (optional)[integer])

    Description

    Returns the keyword cards for the material. Note that a carriage return is not added. See also Material.Keyword()

    Arguments

  • index (optional) (integer)

    If this argument is not given then the material keyword cards are returned as normal. However if the material also has *MAT_ADD_xxxx cards defined for it (e.g. *MAT_ADD_EROSION) then the index can be used to return the cards for the *MAT_ADD card instead. The index value starts from zero. The number of *MAT_ADD cards can be found from the addKeywords property

    Returns

    string containing the cards.

    Return type

    String

    Example

    To get the cards for material m:

    var cards = m.KeywordCards();

    To print all of the keywords and keyword cards for any *MAT_ADD cards for material m:

    for (i=0; i<m.addKeywords; i++)
    {
        Message(m.Keyword(i));
        Message(m.KeywordCards(i));
    }


    Last(Model[Model]) [static]

    Description

    Returns the last material in the model.

    Arguments

  • Model (Model)

    Model to get last material in

    Returns

    Material object (or null if there are no materials in the model).

    Return type

    Material

    Example

    To get the last material in model m:

    var m = Material.Last(m);


    LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]

    Description

    Returns the last free material label in the model. Also see Material.FirstFreeLabel(), Material.NextFreeLabel() and see Model.LastFreeItemLabel()

    Arguments

  • Model (Model)

    Model to get last free material label in

  • layer (optional) (Include number)

    Include file (0 for the main file) to search for labels in (Equivalent to Highest free in layer in editing panels). If omitted the whole model will be used.

    Returns

    Material label.

    Return type

    Number

    Example

    To get the last free material label in model m:

    var label = Material.LastFreeLabel(m);


    Next()

    Description

    Returns the next material in the model.

    Arguments

    No arguments

    Returns

    Material object (or null if there are no more materials in the model).

    Return type

    Material

    Example

    To get the material in model m after material m:

    var m = m.Next();


    NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]

    Description

    Returns the next free (highest+1) material label in the model. Also see Material.FirstFreeLabel(), Material.LastFreeLabel() and Model.NextFreeItemLabel()

    Arguments

  • Model (Model)

    Model to get next free material label in

  • layer (optional) (Include number)

    Include file (0 for the main file) to search for labels in (Equivalent to Highest+1 in layer in editing panels). If omitted the whole model will be used (Equivalent to Highest+1 in editing panels).

    Returns

    Material label.

    Return type

    Number

    Example

    To get the next free material label in model m:

    var label = Material.NextFreeLabel(m);


    Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]

    Description

    Allows the user to pick a material.

    Arguments

  • prompt (string)

    Text to display as a prompt to the user

  • limit (optional) (Model or Flag)

    If the argument is a Model then only materials from that model can be picked. If the argument is a Flag then only materials that are flagged with limit can be selected. If omitted, or null, any materials from any model can be selected. from any model.

  • modal (optional) (boolean)

    If picking is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the pick will be modal.

  • button text (optional) (string)

    By default the window with the prompt will have a button labelled 'Cancel' which if pressed will cancel the pick and return null. If you want to change the text on the button use this argument. If omitted 'Cancel' will be used.

    Returns

    Material object (or null if not picked)

    Return type

    Material

    Example

    To pick a material from model m giving the prompt 'Pick material from screen':

    var m = Material.Pick('Pick material from screen', m);


    PoissonsRatio()

    Description

    Get Poissons ratio for the material.

    Arguments

    No arguments

    Returns

    real

    Return type

    Number

    Example

    To get Poissons ratio for material m:

    var pr = m.PoissonsRatio(f);


    Previous()

    Description

    Returns the previous material in the model.

    Arguments

    No arguments

    Returns

    Material object (or null if there are no more materials in the model).

    Return type

    Material

    Example

    To get the material in model m before material m:

    var m = m.Previous();


    RemoveMaterialErosion()   [deprecated]

    This function is deprecated in version 20.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Removes the Erosion properties for this Material object.

    Arguments

    No arguments

    Returns

    No return value

    Example

    To remove the Erosion properties for material m:

    m.RemoveMaterialErosion();
    


    RenumberAll(Model[Model], start[integer]) [static]

    Description

    Renumbers all of the materials in the model.

    Arguments

  • Model (Model)

    Model that all materials will be renumbered in

  • start (integer)

    Start point for renumbering

    Returns

    No return value

    Example

    To renumber all of the materials in model m, from 1000000:

    Material.RenumberAll(m, 1000000);


    RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]

    Description

    Renumbers all of the flagged materials in the model.

    Arguments

  • Model (Model)

    Model that all the flagged materials will be renumbered in

  • flag (Flag)

    Flag set on the materials that you want to renumber

  • start (integer)

    Start point for renumbering

    Returns

    No return value

    Example

    To renumber all of the materials in model m flagged with f, from 1000000:

    Material.RenumberFlagged(m, f, 1000000);


    Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]

    Description

    Allows the user to select materials using standard PRIMER object menus.

    Arguments

  • flag (Flag)

    Flag to use when selecting materials

  • prompt (string)

    Text to display as a prompt to the user

  • limit (optional) (Model or Flag)

    If the argument is a Model then only materials from that model can be selected. If the argument is a Flag then only materials that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any materials can be selected. from any model.

  • modal (optional) (boolean)

    If selection is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the selection will be modal.

    Returns

    Number of materials selected or null if menu cancelled

    Return type

    Number

    Example

    To select materials from model m, flagging those selected with flag f, giving the prompt 'Select materials':

    Material.Select(f, 'Select materials', m);

    To select materials, flagging those selected with flag f but limiting selection to materials flagged with flag l, giving the prompt 'Select materials':

    Material.Select(f, 'Select materials', l);


    SetAddDamageGissmoData(data[object])

    Description

    Sets the *MAT_ADD_DAMAGE_GISSMO data of material.

    Arguments

  • data (object)

    Data returned from Material.GetAddDamageGissmoData

    Object has the following properties:

    Name Type Description
    biaxf real Reduction factor for regularization at triaxiality=2/3
    dcrit real Damage treshold value
    dmgexp real Exponent for nonlinear damage accumalation
    dtyp real Flag for GISSMO damage type
    ecrit real/integer Critical plastic strain (Curve/ table ID if negative)
    fadexp real/integer Exponent for damage-related stress fadeout (Curve/ table ID if negative)
    hisvn real History variable used to evaluate th 3-D table LCSDG
    instf integer Flag for governing the behavior of instability measure F and fading exponent FADEXP
    lcdlim integer Curve ID: damage limit values as a function of triaxiality
    lcregd integer Curve/ table ID (positive) or Table ID (negative): Element-size dependent fading exponent
    lcsdg integer Curve/ table ID (positive) or Function ID (negative): Failure strain curve/table or function
    lcsoft integer Soft reduction factor for failure strain in crashfront elements.
    lcsrs integer Curve/ table ID: Failure strain rate scaling factor v/s strain rate
    lp2bi real Option to use bending indicator instead of the Lode parameter
    midfail integer Mid-plane failure option for shell elements and GISSMO
    numfip real Number of failed integration points prior to element deletion
    refsz real Reference element size
    rgtr1 real First triaxiality value for optional "tub-shaped" regularization
    rgtr2 real Second triaxiality value for optional "tub-shaped" regularization
    shrf real Reduction factor for regularization at triaxiality=0
    soft real Softening reduction factor for failure strain in crashfront elements
    stochastic logical stochastic = true if _STOCHASTIC is ON. Otherwise, _STOCHASTIC is OFF
    volfrac real Volume fraction required to fail before element deletion

    Returns

    No return value

    Example

    To set the value of MIDFAIL Damage Gissmo for material m to be 3:

    var data = m.GetAddDamageGissmoData();
    data.midfail = 3;
    m.SetAddDamageGissmoData(data);
           


    SetAddErosionData(data[object])

    Description

    Sets the *MAT_ADD_EROSION data of material. Note that this method does not support pre-R11 properties.

    Arguments

  • data (object)

    Data returned from Material.GetAddErosionData.

    Object has the following properties:

    Name Type Description
    dteflt real Time period for the low pass filter
    dtmin real Minimum time step size at failure
    effeps real Maximum effective strain at failure
    engcrt real Critical energy for nonlocal failure criterion
    epssh real Shear strain at failure
    epsthin real Thinning strain at failure for shells
    excl real The exclusion number
    failtm real Failure time
    idam integer Flag for damage model
    impulse real Stress impulse for failure
    lceps12 integer Load curve ID defining in-plane shear strain limit vs elem size
    lceps13 integer Load curve ID defining through-thickness shear strain limit vs elem size
    lcepsmx integer Load curve ID defining in-plane major strain limit vs elem size
    lcfld integer Curve (negative) or table (positive) ID: Forming limit diagram
    lcregd integer Curve ID: Element-size dependent fading exponent
    mneps real Minimum principal strain at failure
    mnpres real Pressure at failure
    mxeps real/integer Principal strain at failure (curve ID if negative)
    mxpres real Maximum pressure at failure
    mxtmp real Maximum temperature at failure
    ncs real Number of failure conditions to satisfy before failure occurs
    nsff real Number of explicit time step cycles for stress fade-out used in the LCFLD criterion
    numfip real Number of failed integration points prior to element deletion
    radcrt real Critical radius for nonlocal failure criterion
    sigp1 real Principal stress at failure
    sigth real Threshold stress
    sigvm real/integer Equivalent stress at failure (curve ID if negative)
    voleps real Volumetric strain at failure
    volfrac real The volume fraction required to fail before the element is deleted

    Returns

    No return value

    Example

    To set the value of EXCL Erosion for material m to be 1.25:

    var data = m.GetAddErosionData();
    data.excl = 1.25;
    m.SetAddErosionData(data);
          


    SetErosionPropertyByName(acronym[string], value[integer/real for numeric properties, string for character properties], idam_index (optional)[integer])   [deprecated]

    This function is deprecated in version 20.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Sets the value of Erosion property string acronym for this Material object

    Arguments

  • acronym (string)

    The acronym of the property value to set

  • value (integer/real for numeric properties, string for character properties)

    The value of the property to set.

  • idam_index (optional) (integer)

    Required if property is one of IDAM cards pair property (for IDAM value less than zero) . If the argument is not given, set the property values for first IDAM cards Pair. The index value starts from zero.

    Returns

    No return value

    Example

    To set the value of IDAM Erosion for material m to be 8:

    m.SetErosionPropertyByName("idam", 8);
    


    SetFlag(flag[Flag])

    Description

    Sets a flag on the material.

    Arguments

  • flag (Flag)

    Flag to set on the material

    Returns

    No return value

    Example

    To set flag f for material m:

    m.SetFlag(f);


    SetMaterialErosion()   [deprecated]

    This function is deprecated in version 20.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Initializes the Erosion properties for this Material object.

    Arguments

    No arguments

    Returns

    No return value

    Example

    To set the Erosion Property for material m:

    m.SetMaterialErosion();
    


    SetPropertyByIndex(index[integer], value[integer/real for numeric properties, string for character properties])

    Description

    Sets the value of property at index index for this Material object

    Arguments

  • index (integer)

    The index of the property value to set. (the number of properties can be found from properties) Note that indices start at 0. There is no link between indices and rows/columns so adjacent fields on a line for a material may not have adjacent indices.

  • value (integer/real for numeric properties, string for character properties)

    The value of the property to set.

    Returns

    No return value

    Example

    To set the property at index 2, for material m to be 1.234:

    m.SetPropertyByIndex(2, 1.234);
    


    SetPropertyByName(acronym[string], value[integer/real for numeric properties, string for character properties])

    Description

    Sets the value of property string acronym for this Material object

    Arguments

  • acronym (string)

    The acronym of the property value to set

  • value (integer/real for numeric properties, string for character properties)

    The value of the property to set.

    Returns

    No return value

    Example

    To set the value of RO for material m to be 7.89e-9:

    m.SetPropertyByName("RO", 7.89e-9);
    


    SetPropertyByRowCol(row[integer], col[integer], value[integer/real for numeric properties, string for character properties])

    Description

    Sets the value of the property for row and col for this Material object.Note that rows and columns start at 0.

    Arguments

  • row (integer)

    The row of the property value to set

  • col (integer)

    The column of the property value to set

  • value (integer/real for numeric properties, string for character properties)

    The value of the property to set.

    Returns

    No return value

    Example

    To set the value of the property at row 0, column 1 for material m to be 7.89e-9:

    m.SetPropertyByRowCol(0, 1, 7.89e-9);


    Sketch(redraw (optional)[boolean])

    Description

    Sketches the material. The material will be sketched until you either call Material.Unsketch(), Material.UnsketchAll(), Model.UnsketchAll(), or delete the model

    Arguments

  • redraw (optional) (boolean)

    If model should be redrawn or not after the material is sketched. If omitted redraw is true. If you want to sketch several materials and only redraw after the last one then use false for redraw and call View.Redraw().

    Returns

    No return value

    Example

    To sketch material m:

    m.Sketch();


    SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]

    Description

    Sketches all of the flagged materials in the model. The materials will be sketched until you either call Material.Unsketch(), Material.UnsketchFlagged(), Model.UnsketchAll(), or delete the model

    Arguments

  • Model (Model)

    Model that all the flagged materials will be sketched in

  • flag (Flag)

    Flag set on the materials that you want to sketch

  • redraw (optional) (boolean)

    If model should be redrawn or not after the materials are sketched. If omitted redraw is true. If you want to sketch flagged materials several times and only redraw after the last one then use false for redraw and call View.Redraw().

    Returns

    No return value

    Example

    To sketch all materials flagged with flag in model m:

    Material.SketchFlagged(m, flag);


    Total(Model[Model], exists (optional)[boolean]) [static]

    Description

    Returns the total number of materials in the model.

    Arguments

  • Model (Model)

    Model to get total for

  • exists (optional) (boolean)

    true if only existing materials should be counted. If false or omitted referenced but undefined materials will also be included in the total.

    Returns

    number of materials

    Return type

    Number

    Example

    To get the total number of materials in model m:

    var total = Material.Total(m);


    Unblank()

    Description

    Unblanks the material

    Arguments

    No arguments

    Returns

    No return value

    Example

    To unblank material m:

    m.Unblank();


    UnblankAll(Model[Model], redraw (optional)[boolean]) [static]

    Description

    Unblanks all of the materials in the model.

    Arguments

  • Model (Model)

    Model that all materials will be unblanked in

  • redraw (optional) (boolean)

    If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().

    Returns

    No return value

    Example

    To unblank all of the materials in model m:

    Material.UnblankAll(m);


    UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]

    Description

    Unblanks all of the flagged materials in the model.

    Arguments

  • Model (Model)

    Model that the flagged materials will be unblanked in

  • flag (Flag)

    Flag set on the materials that you want to unblank

  • redraw (optional) (boolean)

    If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().

    Returns

    No return value

    Example

    To unblank all of the materials in model m flagged with f:

    Material.UnblankFlagged(m, f);


    UnflagAll(Model[Model], flag[Flag]) [static]

    Description

    Unsets a defined flag on all of the materials in the model.

    Arguments

  • Model (Model)

    Model that the defined flag for all materials will be unset in

  • flag (Flag)

    Flag to unset on the materials

    Returns

    No return value

    Example

    To unset the flag f on all the materials in model m:

    Material.UnflagAll(m, f);


    Unsketch(redraw (optional)[boolean])

    Description

    Unsketches the material.

    Arguments

  • redraw (optional) (boolean)

    If model should be redrawn or not after the material is unsketched. If omitted redraw is true. If you want to unsketch several materials and only redraw after the last one then use false for redraw and call View.Redraw().

    Returns

    No return value

    Example

    To unsketch material m:

    m.Unsketch();


    UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]

    Description

    Unsketches all materials.

    Arguments

  • Model (Model)

    Model that all materials will be unblanked in

  • redraw (optional) (boolean)

    If model should be redrawn or not after the materials are unsketched. If omitted redraw is true. If you want to unsketch several things and only redraw after the last one then use false for redraw and call View.Redraw().

    Returns

    No return value

    Example

    To unsketch all materials in model m:

    Material.UnsketchAll(m);


    UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]

    Description

    Unsketches all flagged materials in the model.

    Arguments

  • Model (Model)

    Model that all materials will be unsketched in

  • flag (Flag)

    Flag set on the materials that you want to unsketch

  • redraw (optional) (boolean)

    If model should be redrawn or not after the materials are unsketched. If omitted redraw is true. If you want to unsketch several things and only redraw after the last one then use false for redraw and call View.Redraw().

    Returns

    No return value

    Example

    To unsketch all materials flagged with flag in model m:

    Material.UnsketchAll(m, flag);


    ViewParameters()

    Description

    Object properties that are parameters are normally returned as the integer or float parameter values as that is virtually always what the user would want. This function temporarily changes the behaviour so that if a property is a parameter the parameter name is returned instead. This can be used with 'method chaining' (see the example below) to make sure a property argument is correct.

    Arguments

    No arguments

    Returns

    Material object.

    Return type

    Material

    Example

    To check if Material property m.example is a parameter by using the Material.GetParameter() method:

    if (m.ViewParameters().GetParameter(m.example) ) do_something...


    Warning(message[string], details (optional)[string])

    Description

    Adds a warning for material. For more details on checking see the Check class.

    Arguments

  • message (string)

    The warning message to give

  • details (optional) (string)

    An optional detailed warning message

    Returns

    No return value

    Example

    To add a warning message "My custom warning" for material m:

    m.Warning("My custom warning");


    Xrefs()

    Description

    Returns the cross references for this material.

    Arguments

    No arguments

    Returns

    Xrefs object.

    Return type

    Xrefs

    Example

    To get the cross references for material m:

    var xrefs = m.Xrefs();


    YieldStress()

    Description

    Get Yield stress for the material.

    Arguments

    No arguments

    Returns

    real

    Return type

    Number

    Example

    To get Yield stress for material m:

    var yield = m.YieldStress();


    YoungsModulus()

    Description

    Get Youngs modulus for the material.

    Arguments

    No arguments

    Returns

    real

    Return type

    Number

    Example

    To get Youngs modulus for material m:

    var e = m.YoungsModulus();


    toString()

    Description

    Creates a string containing the material data in keyword format. Note that this contains the keyword header and the keyword cards. See also Material.Keyword() and Material.KeywordCards().

    Arguments

    No arguments

    Returns

    string

    Return type

    String

    Example

    To get data for material m in keyword format

    var s = m.toString();