ElementDeath class

The ElementDeath class gives you access to define element death 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

ElementDeath constants

Name Description
ElementDeath.BEAM Beam option
ElementDeath.BEAM_SET Beam set option
ElementDeath.SHELL Shell option
ElementDeath.SHELL_SET Shell set option
ElementDeath.SOLID Solid option
ElementDeath.SOLID_SET Solid set option
ElementDeath.THICK_SHELL Thick shell option
ElementDeath.THICK_SHELL_SET Thick shell set option

ElementDeath properties

Name Type Description
boxid integer Box restricting element deletion
cid integer Coordinate ID for transforming boxid.
eid integer Element ID or element set ID. The sid property is an alternative name for this.
exists (read only) logical true if element death exists, false if referred to but not defined.
idgrp integer Group ID for simultaneous deletion.
include integer The Include file number that the element death is in.
inout logical If true, Ansys LS-DYNA deletes elements outside box, otherwise inside box.
model (read only) integer The Model number that the element death is in.
option constant ElementDeath option. Can be ElementDeath.SOLID, ElementDeath.SOLID_SET, ElementDeath.BEAM, ElementDeath.BEAM_SET, ElementDeath.SHELL, ElementDeath.SHELL_SET, ElementDeath.THICK_SHELL or ElementDeath.THICK_SHELL_SET. The type property is an alternative name for this.
percent real Deletion percentage.
sid integer Element ID or element set ID. The eid property is an alternative name for this.
time real Deletion time for elimination
title string ElementDeath title
type constant ElementDeath option. Can be ElementDeath.SOLID, ElementDeath.SOLID_SET, ElementDeath.BEAM, ElementDeath.BEAM_SET, ElementDeath.SHELL, ElementDeath.SHELL_SET, ElementDeath.THICK_SHELL or ElementDeath.THICK_SHELL_SET The option property is an alternative name for this.

Detailed Description

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

Constructor

new ElementDeath(Model[Model], type[string], eid/sid[integer])

Description

Create a new ElementDeath object.

Arguments

  • Model (Model)

    Model that element death will be created in

  • type (string)

    ElementDeath type. Can be ElementDeath.SOLID, ElementDeath.SOLID_SET, ElementDeath.BEAM, ElementDeath.BEAM_SET, ElementDeath.SHELL, ElementDeath.SHELL_SET, ElementDeath.THICK_SHELL or ElementDeath.THICK_SHELL_SET

  • eid/sid (integer)

    Element or element set ID

    Returns

    ElementDeath object

    Return type

    ElementDeath

    Example

    To create a new element death in model m with option BEAM_SET and sid 100

    var ed = new ElementDeath(m, ElementDeath.BEAM_SET, 100);

    Details of functions

    AssociateComment(Comment[Comment])

    Description

    Associates a comment with a element death.

    Arguments

  • Comment (Comment)

    Comment that will be attached to the element death

    Returns

    No return value

    Example

    To associate comment c to the element death ed:

    ed.AssociateComment(c);


    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 element death ed:

    ed.Browse();


    ClearFlag(flag[Flag])

    Description

    Clears a flag on the element death.

    Arguments

  • flag (Flag)

    Flag to clear on the element death

    Returns

    No return value

    Example

    To clear flag f for element death ed:

    ed.ClearFlag(f);


    Copy(range (optional)[boolean])

    Description

    Copies the element death. The target include of the copied element death 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

    ElementDeath object

    Return type

    ElementDeath

    Example

    To copy element death ed into element death z:

    var z = ed.Copy();


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

    Description

    Starts an interactive editing panel to create a element death

    Arguments

  • Model (Model)

    Model that the element death 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

    ElementDeath object (or null if not made).

    Return type

    ElementDeath

    Example

    To start creating a element death in model m:

    var ed = ElementDeath.Create(m);


    DetachComment(Comment[Comment])

    Description

    Detaches a comment from a element death.

    Arguments

  • Comment (Comment)

    Comment that will be detached from the element death

    Returns

    No return value

    Example

    To detach comment c from the element death ed:

    ed.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 element death ed:

    ed.Edit();


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

    Description

    Adds an error for element death. 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 element death ed:

    ed.Error("My custom error");


    First(Model[Model]) [static]

    Description

    Returns the first element death in the model.

    Arguments

  • Model (Model)

    Model to get first element death in

    Returns

    ElementDeath object (or null if there are no element deaths in the model).

    Return type

    ElementDeath

    Example

    To get the first element death in model m:

    var ed = ElementDeath.First(m);


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

    Description

    Flags all of the element deaths in the model with a defined flag.

    Arguments

  • Model (Model)

    Model that all element deaths will be flagged in

  • flag (Flag)

    Flag to set on the element deaths

    Returns

    No return value

    Example

    To flag all of the element deaths with flag f in model m:

    ElementDeath.FlagAll(m, f);


    Flagged(flag[Flag])

    Description

    Checks if the element death is flagged or not.

    Arguments

  • flag (Flag)

    Flag to test on the element death

    Returns

    true if flagged, false if not.

    Return type

    Boolean

    Example

    To check if element death ed has flag f set on it:

    if (ed.Flagged(f) ) do_something...


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

    Description

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

    Arguments

  • Model (Model)

    Model that all element deaths are in

  • func (function)

    Function to call for each element death

  • 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 element deaths in model m:

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

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

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


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

    Description

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

    Arguments

  • Model (Model)

    Model to get element deaths from

  • property (optional) (string)

    Name for property to get for all element deaths in the model

    Returns

    Array of ElementDeath objects or properties

    Return type

    Array

    Example

    To make an array of ElementDeath objects for all of the element deaths in model m:

    var a = ElementDeath.GetAll(m);

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

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


    GetComments()

    Description

    Extracts the comments associated to a element death.

    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 element death ed:

    var comm_array = ed.GetComments();


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

    Description

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

    Arguments

  • Model (Model)

    Model to get element deaths from

  • flag (Flag)

    Flag set on the element deaths that you want to retrieve

  • property (optional) (string)

    Name for property to get for all flagged element deaths in the model

    Returns

    Array of ElementDeath objects or properties

    Return type

    Array

    Example

    To make an array of ElementDeath objects for all of the element deaths in model m flagged with f:

    var ed = ElementDeath.GetFlagged(m, f);

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

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


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

    Description

    Returns the ElementDeath object for a element death ID.

    Arguments

  • Model (Model)

    Model to find the element death in

  • number (integer)

    number of the element death you want the ElementDeath object for

    Returns

    ElementDeath object (or null if element death does not exist).

    Return type

    ElementDeath

    Example

    To get the ElementDeath object for element death 100 in model m

    var ed = ElementDeath.GetFromID(m, 100);


    GetParameter(prop[string])

    Description

    Checks if a ElementDeath 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 ElementDeath.ViewParameters() method and 'method chaining' (see the examples below).

    Arguments

  • prop (string)

    element death property to get parameter for

    Returns

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

    Return type

    Parameter

    Example

    To check if ElementDeath property ed.example is a parameter:

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

    To check if ElementDeath property ed.example is a parameter by using the GetParameter method:

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


    Keyword()

    Description

    Returns the keyword for this element death (*DEFINE_ELEMENT_DEATH). Note that a carriage return is not added. See also ElementDeath.KeywordCards()

    Arguments

    No arguments

    Returns

    string containing the keyword.

    Return type

    String

    Example

    To get the keyword for element death ed:

    var key = ed.Keyword();


    KeywordCards()

    Description

    Returns the keyword cards for the element death. Note that a carriage return is not added. See also ElementDeath.Keyword()

    Arguments

    No arguments

    Returns

    string containing the cards.

    Return type

    String

    Example

    To get the cards for element death ed:

    var cards = ed.KeywordCards();


    Last(Model[Model]) [static]

    Description

    Returns the last element death in the model.

    Arguments

  • Model (Model)

    Model to get last element death in

    Returns

    ElementDeath object (or null if there are no element deaths in the model).

    Return type

    ElementDeath

    Example

    To get the last element death in model m:

    var ed = ElementDeath.Last(m);


    Next()

    Description

    Returns the next element death in the model.

    Arguments

    No arguments

    Returns

    ElementDeath object (or null if there are no more element deaths in the model).

    Return type

    ElementDeath

    Example

    To get the element death in model m after element death ed:

    var ed = ed.Next();


    Previous()

    Description

    Returns the previous element death in the model.

    Arguments

    No arguments

    Returns

    ElementDeath object (or null if there are no more element deaths in the model).

    Return type

    ElementDeath

    Example

    To get the element death in model m before element death ed:

    var ed = ed.Previous();


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

    Description

    Allows the user to select element deaths using standard PRIMER object menus.

    Arguments

  • flag (Flag)

    Flag to use when selecting element deaths

  • prompt (string)

    Text to display as a prompt to the user

  • limit (optional) (Model or Flag)

    If the argument is a Model then only element deaths from that model can be selected. If the argument is a Flag then only element deaths that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any element deaths 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 element deaths selected or null if menu cancelled

    Return type

    Number

    Example

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

    ElementDeath.Select(f, 'Select element deaths', m);

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

    ElementDeath.Select(f, 'Select element deaths', l);


    SetFlag(flag[Flag])

    Description

    Sets a flag on the element death.

    Arguments

  • flag (Flag)

    Flag to set on the element death

    Returns

    No return value

    Example

    To set flag f for element death ed:

    ed.SetFlag(f);


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

    Description

    Returns the total number of element deaths in the model.

    Arguments

  • Model (Model)

    Model to get total for

  • exists (optional) (boolean)

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

    Returns

    number of element deaths

    Return type

    Number

    Example

    To get the total number of element deaths in model m:

    var total = ElementDeath.Total(m);


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

    Description

    Unsets a defined flag on all of the element deaths in the model.

    Arguments

  • Model (Model)

    Model that the defined flag for all element deaths will be unset in

  • flag (Flag)

    Flag to unset on the element deaths

    Returns

    No return value

    Example

    To unset the flag f on all the element deaths in model m:

    ElementDeath.UnflagAll(m, f);


    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

    ElementDeath object.

    Return type

    ElementDeath

    Example

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

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


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

    Description

    Adds a warning for element death. 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 element death ed:

    ed.Warning("My custom warning");


    Xrefs()

    Description

    Returns the cross references for this element death.

    Arguments

    No arguments

    Returns

    Xrefs object.

    Return type

    Xrefs

    Example

    To get the cross references for element death ed:

    var xrefs = ed.Xrefs();


    toString()

    Description

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

    Arguments

    No arguments

    Returns

    string

    Return type

    String

    Example

    To get data for element death ed in keyword format

    var s = ed.toString();