Request

Response

    Extensions

    Autodesk.Viewing.Extensions.Measure.MeasureExtension

    new MeasureExtension(viewer,options)

    Extension used to support distance and angle measure for 2d and 3d models.

    Parameters

    viewer*Viewer to be extended.
    options*
    object
    An optional dictionary of options for this extension.
    * Required

    Methods

    getDefaultUnit()

    Get the default measure unit in measure tool.

    Returns

    TypeDescription
    string The default measure unit.

    getMeasurement(unitType,precision)

    Get the current measurement in the measure tool.

    Parameters

    unitType*
    string
    Optional measure unit: “decimal-ft”, “ft”, “ft-and-decimal-in”, “decimal-in”, “fractional-in”, “m”, “cm”, “mm” or “m-and-cm”.
    precision*
    number
    Optional measure precision index (0: 0, 1: 0.1, 2: 0.01, 3: 0.001, 4: 0.0001, 5: 0.00001). When units type is “ft”, “in” or “fractional-in”, then the precisions are 0: 1, 1: 1/2, 2: 1/4, 3: 1/8, 4: 1/16, 5: 1/32, 6: 1/64.
    * Required

    Returns

    TypeDescription
    object|null Object with properties of the current measurement, or null.

    getPrecisionOptions(isFractional)

    Get all available precisions in measure tool.

    Parameters

    isFractional*
    boolean
    Set true to get fractional precisions.
    * Required

    Returns

    TypeDescription
    Array.<string> List of all available precisions.

    getUnitOptions()

    Get all available units in measure tool.

    Returns

    TypeDescription
    Array.<object> Array of all available units.

    isActive()

    Whether the measure tool is currently active.

    Returns

    TypeDescription
    boolean

    load()

    Load the measure extension.

    Returns

    TypeDescription
    boolean True if measure extension is loaded successfully.

    setActive(active)

    Enable/disable the measure tool.

    Parameters

    active*
    boolean
    True to activate, false to deactivate.
    * Required

    Returns

    TypeDescription
    boolean True if a change in activeness occurred.

    toggle()

    Toggles activeness of the measure tool.

    Returns

    TypeDescription
    boolean Whether the tool is active.

    unload()

    Unload the measure extension.

    Returns

    TypeDescription
    boolean True if measure extension is unloaded successfully.
     
    Version 3