Model class

The Model class gives you access to models 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

Model properties

Name Type Description
filename (read only) boolean The model filename
number (read only) integer The model number
state integer The state in the model used for scripting methods. Note that this is not the state that is displayed for a model in a graphics window. This property is only used for some of the scripting methods. Many of the methods in the API depend on which state the model is in and setting this property alters that state. To set the state used for all the "get" and "put" functions which handle model-related data use this property. To change the state that is displayed for a model in a graphics window use the GraphicsWindow state property
states integer The total number of states in the model
title string The model title

Detailed Description

The Model class allows you to do various operations on models in D3PLOT. There are various methods and properties available that allow you do read and operate models. See the documentation below for more details.

Constructor

new Model(filename[string])

Description

Reads a file into the first free model in D3PLOT

Arguments

  • filename (string)

    Filename you want to read

    Returns

    Model object

    Return type

    Model

    Example

    To create a model in D3PLOT for the file /data/test/file.ptf

    var m = new Model("/data/test/file.ptf");

    Details of functions

    ClearFlag(flag[Flag])

    Description

    Clears a flag on all of the items in the model

    Arguments

  • flag (Flag)

    Flag (see AllocateFlag) to clear

    Returns

    No return value

    Example

    To clear flag f on all items in model m:

    m.ClearFlag(f);


    Delete()

    Description

    Deletes a model in D3PLOT
    Do not use the Model object after calling this method.

    Arguments

    No arguments

    Returns

    No return value

    Example

    To delete model m in D3PLOT

    m.Delete();


    First() [static]

    Description

    Returns the Model object for the first model in D3PLOT (or null if there are no models)

    Arguments

    No arguments

    Returns

    Model object

    Return type

    Model

    Example

    To get the Model object for the first model:

    var m = Model.First();


    GetFromID(model number[integer]) [static]

    Description

    Returns the Model object for a model ID (or null if model does not exist)

    Arguments

  • model number (integer)

    number of the model you want the Model object for

    Returns

    Model object

    Return type

    Model

    Example

    To get the Model object for model number 1

    var m = Model.GetFromID(1);


    GraphicsWindows()

    Description

    Returns the graphics window(s) that the model exists in

    Arguments

    No arguments

    Returns

    Array of GraphicsWindow objects

    Return type

    array

    Example

    To get the graphics windows model m exists in:

    var list = m.GraphicsWindows();


    Highest() [static]

    Description

    Returns the highest model number in D3PLOT (or 0 if no models). Also see Total()

    Arguments

    No arguments

    Returns

    Highest model number

    Return type

    integer

    Example

    To get the highest model number:

    var highest = Model.Highest();


    Last() [static]

    Description

    Returns the Model object for the last model in D3PLOT (or null if there are no models)

    Arguments

    No arguments

    Returns

    Model object

    Return type

    Model

    Example

    To get the Model object for the last model:

    var m = Model.Last();


    Next()

    Description

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

    Arguments

    No arguments

    Returns

    Model object

    Return type

    Model

    Example

    To get the model after model m:

    m = m.Next();


    Previous()

    Description

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

    Arguments

    No arguments

    Returns

    Model object

    Return type

    Model

    Example

    To get the model before model m:

    m = m.Previous();


    Read(filename[string]) [static]

    Description

    Reads a file into D3PLOT

    Arguments

  • filename (string)

    Filename you want to read

    Returns

    Model object

    Return type

    Model

    Example

    To create a model in D3PLOT from the file /data/test/file.ptf

    var m = Model.Read("/data/test/file.ptf");


    ReadPropertiesFile(filename[string], info (optional)[object])

    Description

    Reads a properties file for the model

    Arguments

  • filename (string)

    Filename for the properties file you want to read

  • info (optional) (object)

    Object containing the information to set. Can be any of:

    Object has the following properties:

    Name Type Description
    ignoreElements boolean Ignore any element properties in the properties file and only process part based entries (default is false)
    preBlank boolean Blank everything in the model before reading the properties file (default is false)

    Returns

    No return value

    Example

    To read the properties file /data/test/my_properties.prp for model m:

    m.ReadPropertiesFile("/data/test/my_properties.prp");


    Reread()

    Description

    Rereads the model

    Arguments

    No arguments

    Returns

    No return value

    Example

    To reread model m:

    m.Reread();


    Rescan()

    Description

    Rescans the model

    Arguments

    No arguments

    Returns

    No return value

    Example

    To rescan model m:

    m.Rescan();


    Time(state[integer])

    Description

    Returns the analysis time for a particular state in the model

    Arguments

  • state (integer)

    The state you want to get the time for (0 <= state <= states)

    Returns

    Analysis time

    Return type

    real

    Example

    To get the analysis time for state 10 in model m:

    var time = m.Time(10);


    Total() [static]

    Description

    Returns the total number of models in use in D3PLOT. Also see Highest()

    Arguments

    No arguments

    Returns

    Total number of models in use

    Return type

    integer

    Example

    To get total number of models:

    var total = Model.Total();