Windows

Functions and constants relating to Windows

Functions

Details of functions

CreateWindow(model_list[Array of integers|integer]) [static]

Description

Creates a new window containing one or more models contained in model_list

Arguments

  • model_list (Array of integers|integer)

    Model number(s). Can be a single model number, an array of model numbers or the constant ALL

    Returns

    boolean

    Return type

    Boolean

    Example

    // Create a new window containing models #2 and #3
    var a = new Array(2, 3);
    CreateWindow(a);
    
    // Create a new window containing model #6
    CreateWindow(6);
    
    // Create a new window containing all currently active models
    CreateWindow(ALL);
    


    DeleteWindow(window_list[Array of numbers|number], dispose_flag (optional)[integer]) [static]

    Description

    Deletes one or more windows in window_list, dealing with "orphaned" models according to dispose_flag.

    WARNING
    • D3PLOT does not permit gaps in window numbering, therefore when a window is deleted any windows higher than this are renumbered downwards to fill the gap.
    • However D3PLOT does not renumber models following the deletion of preceding ones. Deleted model ids simply become "inactive".
    This means that following a window deletion operation:
    • The total number of windows will change.
    • Any window ids above those deleted will have been renumbered downwards.
    • If any orphan models were deleted these models will now be inactive.
    • If the current Javascript model has been deleted then the "current" model pointer will be reset to the first active model, or <undefined> if there are no such models.
    Therefore if a script is to continue execution after a window deletion operation it is prudent to ensure that any "current" user-defined variables in the Javascript are reset to sensible values.

    Arguments

  • window_list (Array of numbers|number)

    Window numbers. Can be a single window number, an array of window numbers or the constant ALL

  • dispose_flag (optional) (integer)

    LEAVE (default) leaves orphaned models in the database or DELETE deletes orphaned models

    Returns

    boolean

    Return type

    Boolean

    Example

    // Delete windows #2 and #3 leaving any orphaned models in the database
    var a = new Array(2, 3);
    DeleteWindow(a);
    
    // Delete window #6, also deleting any orphaned models
    DeleteWindow(6, DELETE);
    


    GetWindowFrame(window_id[integer]) [static]

    Description

    Returns the current "frame" in window_id

    See the notes in GetWindowMaxFrame() on how frame number relates to state number

    Arguments

  • window_id (integer)

    Window number or ALL. Specifies the window(s) to have the frame number set

    Returns

    integer

    Return type

    Number

    Example

    // Get the current frame of window #1
    var a = GetWindowFrame(1);
    


    GetWindowMaxFrame(window_id[integer]) [static]

    Description

    Returns the highest "frame" number in window_id

    "Frame" number is usually the same as state number, but there are a few situations when this is not the case:

    • Eigenvalue analyses. Each state is animated though #frames between +/-180 degrees phase angle
    • Nastran-derived static analyses. Each loadcase is likewise animated through #frames
    • Transient analyses that are being interpolated by time, giving (endtime / time interval) frames

    In all cases animating a window results in it cycling through frames 1 to max #frames.

    Arguments

  • window_id (integer)

    Window number

    Returns

    integer

    Return type

    Number

    Example

    // Get the highest frame of number in window #2
    var a = GetWindowMaxFrame(2);
    


    GetWindowModels(window_id[integer]) [static]

    Description

    Returns the model number(s) in window_id

    Every active window in D3PLOT must have at least one model, but may have any number

    Arguments

  • window_id (integer)

    Window number

    Returns

    Object with the following properties:

    Name Type Description
    list Array of integers List of model numbers
    nm integer the number of models in the window

    Return type

    object

    Example

    // Get list of model numbers in window #1
    var a = GetWindowModels(1);
    
    for(i=0; i<a.nm; i++)
    {
        Message("Model " + a.list[i] + " in window 1");
    }
    


    SetWindowActive(window_id[integer], active_flag[integer]) [static]

    Description

    Set the "active" flag on a window.

    When more than one window is in use it is convenient to be able to operate on a group of "active" windows with a single command in the JavaScript, rather than having to loop over selected windows each time, and this function provides that capability. This activity status is used solely within the Javascript interface and does not have any bearing upon or connection with the Wn "tabs" used in the graphical userinterface.

    By default all windows are active (ON), but you can change this by setting the activity of specific windows ON or OFF.

    Arguments

  • window_id (integer)

    Window number or ALL. Specifies the window(s) to have their status set

  • active_flag (integer)

    OFF or ON. OFF makes the selected window(s) inactive, ON makes window(s) active

    Returns

    boolean

    Return type

    Boolean

    Example

    // Turn off the activity flag for window #1
    SetWindowActive(1, OFF);
    
    // Make all current windows active
    SetWindowActive(ALL, ON);
    


    SetWindowFrame(window_id[integer], frame_number[integer]) [static]

    Description

    Sets the current "frame" in the window(s) specified to frame_number.

    The effect is immediate and the window(s) will be redrawn if necessary to show the requested frame

    See the notes in GetWindowMaxFrame() on how frame number relates to state number

    Arguments

  • window_id (integer)

    Window number or ALL

  • frame_number (integer)

    The frame number to set. Should be a +ve integer value in the range 1 to max #frames in window. Values greater than max #frames are truncated to this

    Returns

    boolean

    Return type

    Boolean

    Example

    // Set window #1 to display frame #10
    SetWindowFrame(1, 10);
    
    // Set all windows to display frame #3
    SetWindowFrame(ALL, 3);