Set (SetK) class

The Set class gives you access to sets 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

Set constants

Name Description
Set.2D_SEGMENT This constant is deprecated in version 11.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.
Please use Set.SEGMENT_2D instead.  [deprecated]
Set.ADD Set type is *SET_XYZ_ADD.
Set.ALL_TYPES All set types - used in blanking etc.
Set.BEAM Set beam type
Set.BOX Set box type
Set.DISCRETE Set discrete type
Set.GENERAL Set type is *SET_XYZ_GENERAL.
Set.GENERATE Set type is *SET_XYZ_GENERATE.
Set.IGA_EDGE Set IGA edge uvw/xyz type
Set.IGA_FACE Set IGA face uvw/xyz type
Set.IGA_POINT_UVW Set IGA point uvw type
Set.IGA_UVW Set UVW option for *SET_IGA_EDGE and *SET_IGA_FACE.
Set.IGA_XYZ Set XYZ option for *SET_IGA_EDGE and *SET_IGA_FACE.
Set.INTERSECT Set type is *SET_XYZ_INTERSECT.
Set.MM_GROUP Set multi-material group type
Set.MODE Set mode type
Set.NODE Set node type
Set.PART Set part type
Set.PART_TREE Set part tree type
Set.PERI_LAMINATE Set Peri Laminate type
Set.SEGMENT Set segment type
Set.SEGMENT_2D Set segment 2d type
Set.SHELL Set shell type
Set.SOLID Set solid type
Set.TSHELL Set thick shell type

Set properties

Name Type Description
add logical If _ADD option is active.
advanced (read only) logical If _ADD_ADVANCED option is active.
collect logical If _COLLECT option is active. To manage _COLLECT sets PRIMER creates a 'parent' set that can be used to sketch/view all of the items from the _COLLECT sets with the same label. PRIMER then manages each _COLLECT set with the same label as a 'child' of this 'parent' set. Also see collect_children and GetCollectChild. If the collect property is unset for a child collect set then a new label will be assigned for the child set. If the collect property is unset for a parent collect set then all of the child sets will be reassigned new labels.
collect_children (read only) integer The number of child _COLLECT sets if _COLLECT option is active.
colour Colour The colour of the set
column (read only) logical If _COLUMN option is active.
da1 real The first default attribute for the set (only valid for Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.NODE, Set.PART, Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
da2 real The second default attribute for the set (only valid for Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.NODE, Set.PART, Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
da3 real The third default attribute for the set (only valid for Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.NODE, Set.PART, Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
da4 real The fourth default attribute for the set (only valid for Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.NODE, Set.PART, Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
exists (read only) logical true if set exists, false if referred to but not defined.
general logical If _GENERAL option is active.
general_lines (read only) integer Number of lines of data for _GENERAL set (if _GENERAL option is active).
generate logical If _GENERATE option is active.
iga_opt (read only) constant Option for IGA_EGDE and IGA_FACE. Can be Set.IGA_UVW, Set.IGA_XYZ
include integer The Include file number that the set is in.
increment (read only) logical If _GENERATE_INCREMENT option is active.
intersect logical If _INTERSECT option is active.
its integer Coupling type across different scales in two-scale cosimulation (only valid for Set.SEGMENT or Set.NODE).
label integer Set number. Also see the sid property which is an alternative name for this.
model integer The Model number that the set is in.
sid integer Set number. Also see the label property which is an alternative name for this.
smooth (read only) logical If _LIST_SMOOTH option is active.
solver string Solver to attach to set. Can be "MECH", "CESE", "EM", "ICFD" or blank (only valid for Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.NODE, Set.PART, Set.SEGMENT and Set.SOLID).
title string Set title
total (read only) integer The total number of items in the set. Note that for _GENERAL and _GENERATE sets this is expensive to compute.
transparency integer The transparency of the set (0-100) 0% is opaque, 100% is transparent.
type (read only) constant Set type. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

Detailed Description

The Set class allows you to create, modify, edit and manipulate sets. See the documentation below for more details.
ECMAScript 6 defines a Set class for Set objects so unfortunately this clashes with the Set class we have defined in PRIMER for the Ansys LS-DYNA keyword *SET. By default the Set class is used for the Ansys LS-DYNA keyword *SET but this can be changed by using the preference 'set_class' in the preferences editor.
The Ansys LS-DYNA keyword *SET class is also available (regardless of whether Set is used for the keyword or ECMAScript 6 Set objects) by using SetK (similarly to Nrb being an alias for the NodalRigidBody class).

For convenience "SetK" can also be used as the class name instead of "Set".

Constructor

new Set(Model[Model], details[object])

Description

Create a new Set object.

Arguments

  • Model (Model)

    Model that set will be created in

  • details (object)

    Details for creating the Set

    Object has the following properties:

    Name Type Description
    iga_opt (optional) constant IGA type. Can be Set.IGA_UVW or Set.IGA_XYZ. Only valid for set types Set.IGA_EDGE and Set.IGA_FACE where it must be given
    option (optional) constant Set type. Can be Set.ADD, Set.INTERSECT, Set.GENERAL or Set.GENERATE
    sid integer Set number
    title (optional) string Title for the set
    type constant Type of set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

    Returns

    Set object

    Return type

    Set

    Example

    To create a new node set in model m with label 100:

    var s = new Set(m, {sid:100, type:Set.NODE});

    To create a new *NODE_SET_ADD in model m with label 101:

    var s = new Set(m, {sid:101, type:Set.NODE, title:"", option:Set.ADD});

    To create a new *SET_IGA_EDGE_XYZ in model m with label 102:

    var s = new Set(m, {sid:102, type:Set.IGA_EDGE, title:"Set of IGA_EDGE_XYZ", iga_opt:Set.IGA_XYZ});

    new Set(Model[Model], sid[integer], type[constant], title (optional)[string], option (optional)[constant])   [deprecated]

    This function is deprecated in version 22.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

    Create a new Set object.

    Arguments

  • Model (Model)

    Model that set will be created in

  • sid (integer)

    Set number

  • type (constant)

    Type of set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

  • title (optional) (string)

    Title for the set

  • option (optional) (constant)

    Set type. Can be Set.ADD, Set.INTERSECT, Set.GENERAL or Set.GENERATE

    Returns

    Set object

    Return type

    Set

    Example

    To create a new node set in model m with label 100:

    var s = new Set(m, 100, Set.NODE);

    To create a new *NODE_SET_ADD in model m with label 101:

    var s = new Set(m, 101, Set.NODE,"", Set.ADD);

    Details of functions

    Add(id1[integer], id2 (optional)[integer], id3 (optional)[integer], id4 (optional)[integer])

    Description

    Adds an item to the set. This cannot be used for _COLUMN and _GENERAL sets. For segment sets four nodes must be given to define a segment to add to the set.

    Arguments

  • id1 (integer)

    id of the item to add to the set (normal, _ADD or _ADD_ADVANCED sets) or Start ID (_GENERATE sets)

  • id2 (optional) (integer)

    type of the item to add to the set [1-7] (_ADD_ADVANCED sets) or End ID (_GENERATE sets)
    (only for SEGMENT, _GENERATE, _GENERATE_INCREMENT and _ADD_ADVANCED sets)

  • id3 (optional) (integer)

    Increment for _GENERATE_INCREMENT sets, otherwise id of the item to add to the set
    (only for SEGMENT and _GENERATE_INCREMENT sets)

  • id4 (optional) (integer)

    id of the item to add to the set
    (only for SEGMENT sets)

    Returns

    No return value

    Example

    To add node 10 to node set ns:

    ns.Add(10);

    To add segment 10, 11, 12, 13 to segment set ss:

    ss.Add(10, 11, 12, 13);


    SET PART TREE is a special type of set, which can contain PARTs (negative) and/or child SET PART TREEs (positive).
    To add part 10 to SET PART TREE spt:

    spt.Add(-10);

    To add child SET PART TREE 20 to SET PART TREE spt:

    spt.Add(20);


    AddCollectChild(set[Set])

    Description

    Adds a child collect set to the set. The child set label will be changed to be the same as the parent set and it will become a child. Also see Set.collect_children and Set.GetCollectChild.

    Arguments

  • set (Set)

    Set to be added as a child collect set.

    Returns

    No return value

    Example

    To make set ns2 to node set ns:

    ns.AddCollectChild(ns2);


    AddFlagged(flag[Flag])

    Description

    Adds flagged items to the set. This cannot be used for _GENERAL or _GENERATE sets and cannot be used for segment sets

    Arguments

  • flag (Flag)

    Flag for items to add to the set

    Returns

    No return value

    Example

    To add any nodes flagged with flag f to node set ns:

    ns.AddFlagged(f);


    AllItems()

    Description

    Returns an array containing all of the items in the set, decomposing any complex set definitions as required to give those items. For Set.SEGMENT sets, each index in the array is an array containing the segment node IDs. For all other set types each index in the array is an item ID

    Arguments

    No arguments

    Returns

    array

    Return type

    Array

    Example

    To get the items in set s:

    var items = s.AllItems();


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

    Description

    Blanks all of the sets in the model.

    Arguments

  • Model (Model)

    Model that all sets will be blanked in

  • type (optional) (constant)

    Type of sets to blank. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.MM_GROUP, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. Set.ALL_TYPES. If omitted sets of all types will be blanked.

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

    Set.BlankAll(m);

    To blank all of the node sets in model m:

    Set.BlankAll(m, Set.NODE);


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

    Description

    Blanks all of the flagged sets in the model.

    Arguments

  • Model (Model)

    Model that all the flagged sets will be blanked in

  • flag (Flag)

    Flag set on the sets that you want to blank

  • type (optional) (constant)

    Type of sets to blank. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.MM_GROUP, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. Set.ALL_TYPES. If set, only flagged sets of this type will be blanked. If omitted flagged sets of all types will be blanked.

  • 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 sets in model m flagged with f:

    Set.BlankFlagged(m, f);

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

    Set.BlankFlagged(m, f, Set.NODE);


    Blanked()

    Description

    Checks if the set is blanked or not.

    Arguments

    No arguments

    Returns

    true if blanked, false if not.

    Return type

    Boolean

    Example

    To check if set s is blanked:

    if (s.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 set s:

    var s.Browse();


    ClearFlag(flag[Flag])

    Description

    Clears a flag on the set.

    Arguments

  • flag (Flag)

    Flag to clear on the set

    Returns

    No return value

    Example

    To clear flag f for set s:

    s.ClearFlag(f);


    Contains(id[integer])

    Description

    Checks if an item is in the set. This cannot be used for ADD_ADVANCED, _GENERAL or _GENERATE sets and cannot be used for segment sets

    Arguments

  • id (integer)

    id of the item to check.

    Returns

    true if item is in set, false if not

    Return type

    Boolean

    Example

    To see if node 10 is in node set ns:

    if (ns.Contains(10) )
    {
        do something...
    }


    Copy(range (optional)[boolean])

    Description

    Copies the set.

    Arguments

  • range (optional) (boolean)

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

    Returns

    Set object

    Return type

    Set

    Example

    To copy node net ns into node net ns1:

    var ns1 = ns.Copy();


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

    Description

    Starts an interactive editing panel to create a set.

    Arguments

  • Model (Model)

    Model that the set will be created in

  • type (constant)

    Type of the set that you want to create. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

  • 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

    Set object (or null if not made)

    Return type

    Set

    Example

    To start creating a node set in model m:

    var s = Set.Create(m, Set.NODE);


    Edit(modal (optional)[boolean])

    Description

    Starts an interactive editing panel to edit the set.

    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 set s:

    var s.Edit();


    Empty()

    Description

    Removes all items from the set. This cannot be used for _GENERATE sets and cannot be used for segment sets

    Arguments

    No arguments

    Returns

    No return value

    Example

    To remove all nodes from node set ns:

    ns.Empty(f);


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

    Description

    Adds an error for a set. 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 set s:

    s.Error("My custom error");


    First(Model[Model], type[constant]) [static]

    Description

    Returns the first set in the model.

    Arguments

  • Model (Model)

    Model to get first set in

  • type (constant)

    Type of the set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

    Returns

    Set object (or null if there are no sets in the model).

    Return type

    Set

    Example

    To get the first node set in model m:

    var n = Set.First(m, Set.NODE);


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

    Description

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

    Arguments

  • Model (Model)

    Model to get first free Set label in

  • type (constant)

    Type of the set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

  • 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

    Set label.

    Return type

    Number

    Example

    To get the first free node set label in model m:

    var label = Set.FirstFreeLabel(m, Set.NODE);


    FlagAll(Model[Model], flag[Flag], type (optional)[constant]) [static]

    Description

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

    Arguments

  • Model (Model)

    Model that all sets will be flagged in

  • flag (Flag)

    Flag to set on the sets

  • type (optional) (constant)

    Type of the set. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. If set, only sets of this type will be flagged. If omitted sets of all types will be flagged.

    Returns

    No return value

    Example

    To flag all of the node sets with flag f in model m:

    Set.FlagAll(m, f, Set.NODE);


    Flagged(flag[Flag])

    Description

    Checks if the set is flagged or not.

    Arguments

  • flag (Flag)

    Flag to clear on the set

    Returns

    true if flagged, false if not.

    Return type

    Boolean

    Example

    To check if set s has flag f set on it:

    if (s.Flagged(f) ) do_something...


    GetAll(Model[Model], type[constant]) [static]

    Description

    Returns an array of Set objects for all of the sets in a models in PRIMER

    Arguments

  • Model (Model)

    Model to get sets from

  • type (constant)

    Type of the set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

    Returns

    Array of Set objects

    Return type

    Array

    Example

    To make an array of Set objects for all of the node sets in model m

    var n = Set.GetAll(m, Set.NODE);


    GetCollectChild(number[Integer])

    Description

    Returns a child collect set. Also see Set.collect_children and Set.AddCollectChild.

    Arguments

  • number (Integer)

    The index of the child collect set to return. Note that indices start at 0, not 1

    Returns

    Set object

    Return type

    Set

    Example

    To loop over the child collect sets for set ns:

    if (ns.collect)
    {
        for (i=0; i<ns.collect_children; i++)
            var child = ns.GetCollectChild(i);
    }


    GetFlagged(Model[Model], flag[Flag], type[constant]) [static]

    Description

    Returns an array of Set objects for all of the flagged sets in a models in PRIMER

    Arguments

  • Model (Model)

    Model to get sets from

  • flag (Flag)

    Flag set on the set that you want to retrieve

  • type (constant)

    Type of the set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

    Returns

    Array of Set objects

    Return type

    Array

    Example

    To make an array of Set objects for all of the node sets in model m flagged with f

    var n = Set.GetFlagged(m, f, Set.NODE);


    GetFromID(Model[Model], set number[integer], type[constant]) [static]

    Description

    Returns the Set object for a set ID.

    Arguments

  • Model (Model)

    Model to find the set in

  • set number (integer)

    number of the set you want the Set object for

  • type (constant)

    Type of the set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

    Returns

    Set object (or null if set does not exist).

    Return type

    Set

    Example

    To get the Set object for node set 100 in model m

    var n = Set.GetFromID(m, 100, Set.NODE);


    GetGeneralData(index[Integer])

    Description

    Returns a line of data for a GENERAL set.

    Arguments

  • index (Integer)

    The index of the GENERAL data to return. Note that indices start at 0, not 1.
    0 <= index < general_lines

    Returns

    Array containing data.

    Return type

    Array

    Example

    To loop over the lines of general data sets for set s:

    if (s.general)
    {
        for (i=0; i<s.general_lines; i++)
            var data = s.GetGeneralData(i);
    }


    Keyword()

    Description

    Returns the keyword for this set (*SET_NODE etc). Note that a carriage return is not added. See also Set.KeywordCards()

    Arguments

    No arguments

    Returns

    string containing the keyword.

    Return type

    String

    Example

    To get the keyword for set s:

    var key = s.Keyword();


    KeywordCards()

    Description

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

    Arguments

    No arguments

    Returns

    string containing the cards.

    Return type

    String

    Example

    To get the cards for set s:

    var cards = s.KeywordCards();


    Last(Model[Model], type[constant]) [static]

    Description

    Returns the last set in the model.

    Arguments

  • Model (Model)

    Model to get last set in

  • type (constant)

    Type of the set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

    Returns

    Set object (or null if there are no sets in the model).

    Return type

    Set

    Example

    To get the last node set in model m:

    var n = Set.Last(m, Set.NODE);


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

    Description

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

    Arguments

  • Model (Model)

    Model to get last free Set label in

  • type (constant)

    Type of the set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

  • 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

    Set label.

    Return type

    Number

    Example

    To get the last free node set label in model m:

    var label = Set.LastFreeLabel(m, Set.NODE);


    Next()

    Description

    Returns the next set in the model.

    Arguments

    No arguments

    Returns

    Set object (or null if there are no more sets in the model).

    Return type

    Set

    Example

    To get the set in model m after set n:

    var n = n.Next();


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

    Description

    Returns the next free set label in the model. Also see Set.FirstFreeLabel(), Set.LastFreeLabel() and Model.NextFreeItemLabel().

    Arguments

  • Model (Model)

    Model to get next free Set label in

  • type (constant)

    Type of the set. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

  • 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

    Set label.

    Return type

    Number

    Example

    To get the next free node set label in model m:

    var label = Set.NextFreeLabel(m, Set.NODE);


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

    Description

    Allows the user to pick a set.

    Arguments

  • type (constant)

    Type of sets to pick. Can be Set.BEAM, Set.BOX, Set.DISCRETE, Set.MM_GROUP, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL.

  • prompt (string)

    Text to display as a prompt to the user

  • limit (optional) (Model or Flag)

    If the argument is a Model then only sets from that model can be picked. If the argument is a Flag then only sets that are flagged with limit can be selected. If omitted, or null, any sets 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

    Set object (or null if not picked)

    Return type

    Set

    Example

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

    var n = Set.Pick(Set.NODE, 'Pick set from screen', m);


    Previous()

    Description

    Returns the previous set in the model.

    Arguments

    No arguments

    Returns

    Set object (or null if there are no more sets in the model).

    Return type

    Set

    Example

    To get the set in model m before this one:

    var s = s.Previous();


    RebuildCache()

    Description

    Rebuilds the cache for a set. As sets can be built using complex combinations of _GENERAL, _ADD, _INTERSECT options etc PRIMER creates a 'cache' for the set to speed up set drawing and usage. During normal interactive use this cache is rebuilt as necessary but in JavaScript it is possible for the cache to become out of date (e.g. you change a box position in JavaScript that is used by a *SET_GENERAL). Calling this forces the cache to be rebuilt.

    Arguments

    No arguments

    Returns

    No return type

    Return type

    null

    Example

    To rebuild the cache for set s:

    s.RebuildCache();


    Remove(id[integer])

    Description

    Removes an item from the set. If the item is not in the set nothing is done. This cannot be used for ADD_ADVANCED, _COLUMN, _GENERAL or _GENERATE sets and cannot be used for segment sets

    Arguments

  • id (integer)

    id of the item to remove from the set.

    Returns

    No return value

    Example

    To remove node 10 from node set ns:

    ns.Remove(10);


    RemoveFlagged(flag[Flag])

    Description

    Removes flagged items from the set. This cannot be used for _GENERAL or _GENERATE sets and cannot be used for segment sets

    Arguments

  • flag (Flag)

    Flag for items to remove from the set

    Returns

    No return value

    Example

    To remove any nodes flagged with flag f from node set ns:

    ns.RemoveFlagged(f);


    RemoveGeneralData(index[Integer])

    Description

    Removes a line of data from a GENERAL set.

    Arguments

  • index (Integer)

    The index of the GENERAL data to remove. Note that indices start at 0, not 1.
    0 <= index < general_lines

    Returns

    No return value

    Example

    To remove the first line of general data sets for set s:

    if (s.general)
    {
        s.RemoveGeneralData(0);
    }


    RenumberAll(Model[Model], start[integer], type (optional)[constant]) [static]

    Description

    Renumbers all of the sets in the model.

    Arguments

  • Model (Model)

    Model that all sets will be renumbered in

  • start (integer)

    Start point for renumbering

  • type (optional) (constant)

    Type of sets to renumber. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. If omitted sets of all types will be blanked.

    Returns

    No return value

    Example

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

    Set.RenumberAll(m, 1000000);

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

    Set.RenumberAll(m, 1000000, Set.NODE);


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

    Description

    Renumbers all of the flagged sets in the model.

    Arguments

  • Model (Model)

    Model that all the flagged sets will be renumbered in

  • flag (Flag)

    Flag set on the sets that you want to renumber

  • start (integer)

    Start point for renumbering

  • type (optional) (constant)

    Type of sets to renumber. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. If omitted sets of all types will be blanked.

    Returns

    No return value

    Example

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

    Set.RenumberFlagged(m, f, 1000000);

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

    Set.RenumberFlagged(m, f, 1000000, Set.NODE);


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

    Description

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

    Arguments

  • type (constant)

    Type of sets to pick. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL.

  • flag (Flag)

    Flag to use when selecting sets

  • prompt (string)

    Text to display as a prompt to the user

  • limit (optional) (Model or Flag)

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

  • 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 items selected or null if menu cancelled

    Return type

    Number

    Example

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

    Set.Select(Set.NODE, f, 'Select sets', m);


    SetFlag(flag[Flag])

    Description

    Sets a flag on the set.

    Arguments

  • flag (Flag)

    Flag to set on the set

    Returns

    No return value

    Example

    To set flag f for set s:

    s.SetFlag(f);


    SetGeneralData(index[Integer], data[Array of data])

    Description

    Sets a line of data for a GENERAL set.

    Arguments

  • index (Integer)

    The index of the GENERAL data to set. Note that indices start at 0, not 1.
    0 <= index <= general_lines

  • data (Array of data)

    Array containing GENERAL data to set.

    Returns

    No return value.

    Example

    To add nodes inside boxes 1, 2 and 3 as a new line of data to node general set s:

    var data = [ "BOX", 1, 2, 3];
    s.SetGeneralData(s.general_lines, data);


    Sketch(redraw (optional)[boolean])

    Description

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

    Arguments

  • redraw (optional) (boolean)

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

    Returns

    No return value

    Example

    To sketch set s:

    s.Sketch();


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

    Description

    Sketches all of the flagged sets in the model.

    Arguments

  • Model (Model)

    Model that all the flagged sets will be sketched in

  • flag (Flag)

    Flag set on the sets that you want to sketch

  • type (optional) (constant)

    Type of sets to sketch. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.MM_GROUP, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. Set.ALL_TYPES. If set, only flagged sets of this type will be sketched. If omitted flagged sets of all types will be sketched.

  • redraw (optional) (boolean)

    If model should be redrawn or not. If omitted redraw is true. If you want to do several (un)sketches 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 sketch all of the sets in model m flagged with f:

    Set.SketchFlagged(m, f);

    To sketch all of the node sets in model m flagged with f:

    Set.SketchFlagged(m, f, Set.NODE);


    Spool()

    Description

    Spools a set, entry by entry. See also Set.StartSpool

    Arguments

    No arguments

    Returns

    For Set.SEGMENT returns an array containing node IDs, for all other set types returns the ID of the item. Returns 0 if no more items

    Return type

    Array

    Example

    To spool set s:

    var id;
    s.StartSpool();
    while (id = s.Spool()) 
    {
        do something...
    }


    StartSpool(raw (optional)[boolean])

    Description

    Starts a set spooling operation. See also Set.Spool

    Arguments

  • raw (optional) (boolean)

    If true then the raw data from _GENERATE, _ADD and _INTERSECT sets will be returned instead of expanding the data ranges or child set contents. If omitted raw will be false.

    Returns

    No return value

    Example

    To start spooling set s:

    s.StartSpool();


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

    Description

    Unblanks all of the sets in the model.

    Arguments

  • Model (Model)

    Model that all sets will be unblanked in

  • type (optional) (constant)

    Type of sets to unblank. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.MM_GROUP, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. Set.ALL_TYPES. If omitted sets of all types will be blanked.

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

    Set.UnblankAll(m);

    To unblank all of the node sets in model m:

    Set.UnblankAll(m, Set.NODE);


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

    Description

    Unblanks all of the flagged sets in the model.

    Arguments

  • Model (Model)

    Model that the flagged sets will be unblanked in

  • flag (Flag)

    Flag set on the sets that you want to unblank

  • type (optional) (constant)

    Type of sets to unblank. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.MM_GROUP, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. Set.ALL_TYPES. If set, only flagged sets of this type will be unblanked. If omitted flagged sets of all types will be unblanked.

  • 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 sets in model m flagged with f:

    Set.UnblankFlagged(m, f);

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

    Set.UnblankFlagged(m, f, Set.NODE);


    UnflagAll(Model[Model], flag[Flag], type (optional)[constant]) [static]

    Description

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

    Arguments

  • Model (Model)

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

  • flag (Flag)

    Flag to unset on the sets

  • type (optional) (constant)

    Type of the set. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.IGA_EDGE, Set.IGA_FACE, Set.IGA_POINT_UVW, Set.MM_GROUP, Set.MODE, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL

    Returns

    No return value

    Example

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

    Set.UnflagAll(m, f);


    Unsketch(redraw (optional)[boolean])

    Description

    Unsketches the set.

    Arguments

  • redraw (optional) (boolean)

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

    Returns

    No return value

    Example

    To unsketch set s:

    s.Unsketch();


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

    Description

    Unsketches all sets.

    Arguments

  • Model (Model)

    Model that all sets will be unsketched in

  • type (optional) (constant)

    Type of sets to unsketch. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.MM_GROUP, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. If omitted sets of all types will be unsketched.

  • redraw (optional) (boolean)

    If model should be redrawn or not after the sets 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 sets in model m:

    Set.UnsketchAll(m);


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

    Description

    Unsketches all flagged sets.

    Arguments

  • Model (Model)

    Model that all sets will be unsketched in

  • flag (Flag)

    Flag set on the sets that you want to unsketch

  • type (optional) (constant)

    Type of sets to unsketch. Can be Set.BEAM, Set.BOX Set.DISCRETE, Set.MM_GROUP, Set.NODE, Set.PART, Set.PART_TREE, Set.PERI_LAMINATE, Set.SEGMENT, Set.SEGMENT_2D, Set.SHELL, Set.SOLID or Set.TSHELL. If omitted sets of all types will be unsketched.

  • redraw (optional) (boolean)

    If model should be redrawn or not after the sets 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 sets in model m flagged with f:

    Set.UnsketchFlagged(m, f);

    To unsketch all of the node sets in model m flagged with f:

    Set.UnsketchFlagged(m, f, Set.NODE);


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

    Description

    Adds a warning for a set. 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 set s:

    s.Warning("My custom warning");


    Xrefs()

    Description

    Returns the cross references for this set.

    Arguments

    No arguments

    Returns

    Xrefs object.

    Return type

    Xrefs

    Example

    To get the cross references for this set:

    var xrefs = s.Xrefs();


    toString()

    Description

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

    Arguments

    No arguments

    Returns

    string

    Return type

    String

    Example

    To get data for set n in keyword format

    var s = n.toString();