Material class

The Material class gives you access to materials in D3PLOT. More...

The D3PLOT 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
include (read only) integer The include file number in the model that the material is in
index (read only) integer The internal index for the material in D3PLOT (starting at 0)
label (read only) integer The Ansys LS-DYNA label for the material
model (read only) Model The Model that the material is in
name (read only) string The name for the material type (e.g. *MAT_RIGID)
title (read only) string The title for the material (or null if no title)
type (read only) constant The type for the material (will be Type.MATERIAL)

Detailed Description

The Material class allows you to inspect materials in a model. This information will only be available if a ztf file has been read for a model. See the documentation below for more details.

Details of functions

ClearFlag(flag[Flag])

Description

Clears a flag on a material

Arguments

  • flag (Flag)

    Flag (see AllocateFlag) to clear on the material

    Returns

    No return value

    Example

    To clear flag f on material m:

    m.ClearFlag();


    First(model[Model]) [static]

    Description

    Returns the first material in the model (or null if there are no materials in the model)

    Arguments

  • model (Model)

    Model to get first material in

    Returns

    Material object

    Return type

    Material

    Example

    To get the first material in model m:

    var m = Material.First(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 the materials will be flagged in

  • flag (Flag)

    Flag (see AllocateFlag) 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 (see AllocateFlag) 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...


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

    Description

    Returns an array of Material objects or properties for all of the materials in the model. 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 that all the materials are in

  • 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 get all of the materials in model m:

    var m = Material.GetAll(m);

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

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


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

    Description

    Gets all of the materials in the model flagged with a defined flag. 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 that the flagged materials are in

  • flag (Flag)

    Flag (see AllocateFlag) set on the materials to get

  • 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 get all of the materials flagged with flag f in model m:

    Material.GetFlagged(m, f);

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

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


    GetFromID(model[Model], label[integer]) [static]

    Description

    Returns the Material object for material in model with label (or null if it does not exist)

    Arguments

  • model (Model)

    Model to get material in

  • label (integer)

    The Ansys LS-DYNA label for the material in the model

    Returns

    Material object

    Return type

    Material

    Example

    To get the material in model m with label 1000:

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


    GetFromIndex(model[Model], index[integer]) [static]

    Description

    Returns the Material object for material in model with index (or null if it does not exist)

    Arguments

  • model (Model)

    Model to get material in

  • index (integer)

    The D3PLOT internal index in the model for material, starting at 0.

    Returns

    Material object

    Return type

    Material

    Example

    To get the 51st material in model m:

    var m = Material.GetFromIndex(m, 50);


    Last(model[Model]) [static]

    Description

    Returns the last material in the model (or null if there are no materials in the model)

    Arguments

  • model (Model)

    Model to get last material in

    Returns

    Material object

    Return type

    Material

    Example

    To get the last material in model m:

    var m = Material.Last(m);


    Next()

    Description

    Returns the next material in the model (or null if there is not one)

    Arguments

    No arguments

    Returns

    Material object

    Return type

    Material

    Example

    To get the next material after material m:

    m = m.Next();


    Previous()

    Description

    Returns the previous material in the model (or null if there is not one)

    Arguments

    No arguments

    Returns

    Material object

    Return type

    Material

    Example

    To get the previous material before material m:

    m = m.Previous();


    SetFlag(flag[Flag])

    Description

    Sets a flag on a material

    Arguments

  • flag (Flag)

    Flag (see AllocateFlag) to set on the material

    Returns

    No return value

    Example

    To set flag f on material m:

    m.SetFlag(f);


    Total(model[Model]) [static]

    Description

    Returns the total number of materials in the model

    Arguments

  • model (Model)

    Model to get total in

    Returns

    The number of materials

    Return type

    integer

    Example

    To get the number of materials in model m:

    var total = Material.Total(m);


    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 (see AllocateFlag) to unset on the materials

    Returns

    No return value

    Example

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

    Material.UnflagAll(m, f);