View class

The View class allows you to control the view and plotting modes 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

View constants

Constants for SetContourType - argument 1 (Type)

Name Description
View.ELEMPROPS Type Element Properties
View.ELEMQUAL Type Element Quality
View.INITVELS Type Initial Velocities
View.LOADSHELLDIRECTION Type Load Shell Direction
View.MASSSCALE Type Mass Scale
View.MATLPROPS Type Material Properties
View.PARTMASS Type Part Mass
View.SHELLNORMALS Type Shell Normals
View.SHELLTHICKNESS Type Shell Thickness
View.TIMESTEP Type TimeStep

Constants for SetContourType - argument 2 (Subtype)

Name Description
View.ABSOLUTE Subtype Absolute (of type Shell Thickness)
View.ADDEDMASS Subtype Added Mass (of type Mass Scale)
View.ADDEDMASSPART Subtype Added Mass #Part (of type Mass Scale)
View.AREA Subtype Area (2d only) (of type Element Property)
View.ASPECTRATIO Subtype Aspect Ratio (of type Element Quality)
View.CONTOUR Subtype Contour (of type Shell Normals)
View.DENSITY Subtype Density (of type Material Property)
View.EMPFINALMASS Subtype (*)Final Mass (of type (*)EMP Parts Only)
View.EMPNSMASS Subtype (*)NS Mass (of type (*)EMP Parts Only)
View.EMPSTRUCTMASS Subtype (*)Struct Mass (of type (*)EMP Parts Only)
View.FAILEDCRITERIA Subtype Failed Criteria (of type Element Quality)
View.FINALMASS Subtype Final Mass (of type (*)EMP Parts Only)
View.FORM Subtype Form (native) (of type Element Property)
View.FORMULATION Subtype Formulation (of type Element Property)
View.INITVELRES Subtype Init Vel-Res (of type Init Vel Component)
View.INITVELX Subtype Init Vel-X (of type Init Vel Component)
View.INITVELY Subtype Init Vel-Y (of type Init Vel Component)
View.INITVELZ Subtype Init Vel-Z (of type Init Vel Component)
View.INTPOINTS Subtype Integration Points (of type Element Property)
View.JACOBIAN Subtype Jacobian (of type Element Quality)
View.MATERIALNUMBER Subtype Material Number (of type Material Property)
View.MAXINTANGLE Subtype Max Internal Angle (of type Element Quality)
View.MININTANGLE Subtype Min Internal Angle (of type Element Quality)
View.MINLENGTH Subtype Min Length (of type Element Quality)
View.PERCENTADDEDMASS Subtype % Added Mass (of type Mass Scale)
View.PERCENTADDEDMASSPART Subtype % Added Mass #Part (of type Mass Scale)
View.PLASTICSTRAIN Subtype Plastic Strain (of type Element Property)
View.POISSONRATIO Subtype Poisson's Ratio (of type Material Property)
View.QUALIMPERF Subtype Tet Collapse (of type Element Quality)
View.REMAINING Subtype % remaining (of type Shell Thickness)
View.SKEW Subtype Skew (native) (of type Element Quality)
View.STRUCTMASS Subtype Struct Mass (of type (*)EMP Parts Only)
View.TAPER Subtype Taper (of type Element Quality)
View.TETCOLLAPSE Subtype Formulation (of type Element Quality)
View.THINNING Subtype % thinning (of type Shell Thickness)
View.VECTOR Subtype Vector (of type Shell Normals)
View.VOLUME Subtype Volume (of type Element Property)
View.WARPAGE Subtype Warpage (of type Element Quality)
View.YIELDSTRESS Subtype Yield Stress (of type Material Property)
View.YOUNGMODULUS Subtype Young's Modulus (of type Material Property)

Constants for SetContourType - argument 3 (Subtype)

Name Description
View.INTPOINT Subtype Integration point (of type Element Property)
View.MAXSTRAIN Subtype Maximum Strain (of type Element Property)
View.MINSTRAIN Subtype Minimum Strain (of type Element Property)
View.PARAMETRICCOORD Subtype Parametric coordinate (of type Element Property)

Constants for Show

Name Description
View.ISO Isometric projection
View.XY XY axis projection
View.XZ XZ axis projection
View.YZ YZ axis projection

Constants for up vector

Name Description
View.UP_AUTOMATIC Automatically calculate up vector for target and eye
View.UP_X Set up vector for target and eye to global X
View.UP_Y Set up vector for target and eye to global Y
View.UP_Z Set up vector for target and eye to global Z

Detailed Description

The View class gives you access to the different plotting modes and views. See the documentation below for more details.

Details of functions

Ac() [static]

Description

Autoscales the view

Arguments

No arguments

Returns

No return value

Example

To autoscale

View.Ac();


Ct() [static]

Description

Does a contour plot

Arguments

No arguments

Returns

No return value

Example

To do a contour plot

View.Ct();


GetTargetEye() [static]

Description

Get the current target and eye settings

Arguments

No arguments

Returns

Object with the following properties:

Name Type Description
eye array Array containing the coordinates of the eye position
perspective boolean Whether the perspective switch is active
scale real Scale factor
target array Array containing the coordinates of the target position
up constant/array View.UP_AUTOMATIC, View.UP_X, View.UP_Y, View.UP_Z or an array containing the up vector if user defined

Return type

object

Example

To get the current target and eye information

var info = View.GetTargetEye();


Hi() [static]

Description

Does a Hidden line plot

Arguments

No arguments

Returns

No return value

Example

To do a hidden line plot

View.Hi();


Li() [static]

Description

Does a line (wireframe) plot

Arguments

No arguments

Returns

No return value

Example

To do a line plot

View.Li();


Redraw() [static]

Description

Redraws the plot using the current plot mode.

Arguments

No arguments

Returns

No return value

Example

To redraw

View.Redraw();


SetContourType(View type[constant], View subtype[constant], View subtype2[constant]) [static]

Description

Sets a contour type (and subtype)

Arguments

  • View type (constant)

    The type of contour to plot. Can be:
    View.ELEMPROPS, View.ELEMQUAL, View.INITVELS, View.LOADSHELLDIRECTION, View.MASSSCALE, View.MATLPROPS, View.PARTMASS, View.SHELLNORMALS, View.SHELLTHICKNESS, View.TIMESTEP

  • View subtype (constant)

    The subtype of contour to plot.
    Note: This second argument is NOT required for types TIMESTEP and LOADSHELLDIRECTION.
    Subtypes for Type TIMESTEP:
    No subtypes
    Subtypes for Type SHELLTHICKNESS:
    View.ABSOLUTE, View.REMAINING, View.THINNING
    Subtypes for SHELLNORMALS:
    View.CONTOUR, View.VECTOR
    Subtypes for Type LOADSHELLDIRECTION:
    No subtypes
    Subtypes for Type ELEMPROPS:
    View.AREA, View.FORM, View.FORMULATION, View.INTPOINTS, View.PLASTICSTRAIN, View.VOLUME
    Subtypes for Type ELEMQUAL:
    View.ASPECTRATIO, View.FAILEDCRITERIA, View.JACOBIAN, View.MAXINTANGLE, View.MININTANGLE, View.MINLENGTH, View.QUALIMPERF, View.SKEW, View.TAPER, View.TETCOLLAPSE, View.WARPAGE
    Subtypes for Type MASSSCALE:
    View.ADDEDMASS, View.ADDEDMASSPART, View.PERCENTADDEDMASS, View.PERCENTADDEDMASSPART
    Subtypes for Type MATLPROPS:
    View.DENSITY, View.MATERIALNUMBER, View.POISSONRATIO, View.YIELDSTRESS, View.YOUNGMODULUS
    Subtypes for Type INITVELS:
    View.INITVELX, View.INITVELY, View.INITVELZ, View.INITVELRES
    Subtypes for Type PARTMASS:
    View.EMPFINALMASS, View.EMPNSMASS, View.EMPSTRUCTMASS, View.FINALMASS, View.STRUCTMASS

  • View subtype2 (constant)

    The subtype of contour to plot.
    Note: This third argument is required only for ELEMENTPROP ->PLASTICSTRAIN/FORM/AREA/VOLUME.
    The default is PARAMETRIC COORDINATE.
    Subtypes for Type ELEMENTPROP -> PLASTICSTRAIN/FORM/AREA/VOLUME:
    View.INTEGRATIONPOINT, View.MAXSTRAIN, View.MINSTRAIN, View.PARAMETRICCOORD

    Returns

    No return value

    Example

    To set a contour plot of Load Shell Direction (no subtype):

    View.SetContourType(View.LOADSHELLDIRECTION);

    To set a contour plot of Element Formulation (type: Elem Props, subtype: Formulation):

    View.SetContourType(View.ELEMPROPS, View.FORMULATION);


    SetTargetEye(info[object]) [static]

    Description

    Set the current target and eye settings

    Arguments

  • info (object)

    Object containing the target and eye properties

    Object has the following properties:

    Name Type Description
    eye array Array containing the coordinates of the eye position
    perspective boolean Whether the perspective switch is active. If omitted the default is true
    scale real Scale factor. If omitted, the scaling is automatically calculated (in the same way as if running PRIMER interactively)
    target array Array containing the coordinates of the target position
    up constant/array View.UP_AUTOMATIC, View.UP_X, View.UP_Y, View.UP_Z or an array containing the up vector if user defined. If omitted the default is View.UP_AUTOMATIC

    Returns

    No return value

    Example

    To set the eye position to (-2365.1, -373.2, 1081.1) looking at target (-2075.9, -367.7, 905.2) with the up vector in global Z, automatically turning on perspective and calculating the scale factor:

    View.SetTargetEye( { eye: [-2365.1, -373.2, 1081.1], target: [-2075.9, -367.7, 905.2], up: View.UP_Z } );

    To set the eye position to (-2365.1, -373.2, 1081.1) looking at target (-2075.9, -367.7, 905.2) with the up vector in global Z, turning off perspective and setting the scale factor to 10:

    View.SetTargetEye( { eye: [-2365.1, -373.2, 1081.1], target: [-2075.9, -367.7, 905.2], up: View.UP_Z, perspective: false, scale: 10 } );


    Sh() [static]

    Description

    Does a shaded plot

    Arguments

    No arguments

    Returns

    No return value

    Example

    To do a shaded plot

    View.Sh();


    Show(View type[constant]) [static]

    Description

    Redraws using one of the standard views

    Arguments

  • View type (constant)

    The view to show. Can be +/-View.XY, +/-View.YZ, +/-View.XZ or +/-View.ISO

    Returns

    No return value

    Example

    To do an isometric view from the negative direction:

    View.Show(-View.ISO);


    Si() [static]

    Description

    Does a shaded image contour plot

    Arguments

    No arguments

    Returns

    No return value

    Example

    To do a shaded image contour plot

    View.Si();


    Vec() [static]

    Description

    Does a vector plot

    Arguments

    No arguments

    Returns

    No return value

    Example

    To do a vector plot

    View.Vec();