Materials

Functions and constants relating to Materials

Functions

Details of functions

GetMid(type_code[integer], item[integer], layer_id (optional)[integer], state_id (optional)[integer]) [static]

Description

Returns the external material id of internal <item> of type <type_code>

Use of this function requires that material data be present, which means that a .ztf file must have been read. If the optional <layer_id> argument is used the element must be in a part using a *PART_COMPOSITE definition.

If the material number is requested for a (composite) layer that does not exist in this item a value of zero is returned. No warning message is issued in this situation since experience has shown that this is a common occurrence and excessive warning messages are a nuisance.

Arguments

  • type_code (integer)

    PART or a valid part-based element type code (e.g. SOLID, SHELL)

  • item (integer)

    If +ve, the internal item number starting at 1. If -ve, the external label of the item. Internal numbers will be many times faster to process.

  • layer_id (optional) (integer)

    For composites the layer number 1 - n.

  • state_id (optional) (integer)

    State number to be used instead of the current state

    Returns

    integer

    Return type

    Number

    Example

    // Return the external material id of *PART 2
    var a = GetMid(PART, 2);
    
    // Return the external material id of the 3rd layer of *PART_COMPOSITE 12
    var b = GetMid(PART, 12, 3);
    
    // Return the external material id of the 27th internal shell
    var c = GetMid(SHELL, 27);
    
    // Return the external material id of the 2nd layer of internal shell 100
    // Assumes the part is a *PART_COMPOSITE
    var d = GetMid(SHELL, 100, 2);