Request

Response

    Autodesk.Viewing.Extensions

    SectionExtension

    The SectionExtension provides ways to cut the geometry using planes or a cube. The extension adds a toolbar button to access the feature.

    The extension id is: Autodesk.Section

    Examples

    viewer.loadExtension('Autodesk.Section')
    

    Methods

    Toggles activeness of section planes.

    Returns

    typedescription
    boolean Whether the section plane is active or not.

    getSectionStyle()

    Returns the current type of plane that will cut-though the geometry.

    Returns

    typedescription
    null, string Either “X” or “Y” or “Z” or “BOX” or null.

    setSectionStyle(style, preserveSection)

    Sets the Section plane style.

    Parameters

    style*
    string
    Accepted values are ‘X’, ‘Y’, ‘Z’ and ‘BOX’ (in Caps)
    preserveSection
    boolean
    Whether sending the current style value resets the cut planes.
    * Required

    getState(viewerState)

    Gets the extension state as a plain object. Invoked automatically by viewer.getState()

    Parameters

    viewerState*
    object
    Object to inject extension values.
    * Required

    restoreState(viewerState)

    Restores the extension state from a given object. Invoked automatically by viewer.restoreState()

    Parameters

    viewerState*
    object
    Viewer state.
    * Required

    Returns

    typedescription
    boolean True if restore operation was successful.

    setSectionBox(box)

    Set a section box around the passed in box. This method will also enable the section tool.

    Parameters

    box*used to set the section box.
    * Required

    setSectionPlane(normal, point, enableRotationGizmo)

    Place a section plane on the Intersection. This method will also enable the section tool.

    Parameters

    normal*plane normal.
    point*position to place the plane.
    enableRotationGizmo*
    * Required

    activate(mode)

    Activates a section plane for user to interact with. It performs the same action as the UI button.

    Parameters

    mode*
    string
    Accepted values are ‘x’, ‘y’, ‘z’ and ‘box’ (in lowercase)
    * Required

    Returns

    typedescription
    boolean
    • true if the activation was successful.

    deactivate(keepCutPlanes)

    Removes the section plane/box from the 3D canvas.

    Parameters

    keepCutPlanes*
    keep existing cut planes when deactivating the tool. Default is false.
    * Required

    Returns

    typedescription
    boolean
    • returns true if deactivated, false otherwise.