CADViewer Technical Documentation, Installation Guide and Reference Samples Library

Redlines Callback Methods

CADViewer has two call back methods that is used with Redlines.

Call-back method OnLoadEnd()

When a drawing is loaded, the call-back method cvjs_OnLoadEnd() is executed. This method cvjs_OnLoadEnd() can be used to set the current User Name and ID for use with Redlines and Sticky Notes, these API methods are:

  1. cvjs_setCurrentStickyNoteValues_NameUserId() and
  2. cvjs_setCurrentRedlineValues_NameUserid().

If a Redline has to be loaded with a drawing, then in the cvjs_OnLoadEnd() callback, application programmers can add a method call to set the load path to the redline cvjs_setStickyNoteRedlineUrl(), and then trigger a direct load with cvjs_loadStickyNotesRedline().

function cvjs_OnLoadEnd(){
    // generic callback method, called when the drawing is loaded
    // here you fill in your stuff, call DB, set up arrays, etc..
    // this method MUST be retained as a dummy method! - if not implemeted -
    cvjs_resetZoomPan("floorPlan");
    var user_name = "Bob Smith";
    var user_id = "user_1";
    // set a value for redlines
    cvjs_setCurrentStickyNoteValues_NameUserId(user_name, user_id );
    cvjs_setCurrentRedlineValues_NameUserid(user_name, user_id);
    // name of redline
    cvjs_setStickyNoteRedlineUrl(ServerUrl+"content/redlines/v8/redline-test1.js");
    // API call to load stickynotes and redlines
    cvjs_loadStickyNotesRedlines("floorPlan");
}

Call-back method OnLoadEndRedlines()

Once a redline is loaded, a second call-back method cvjs_OnLoadEndRedlines() is executed.

Using cvjs_OnLoadEndRedlines() , the redlines can be locked for editing for a set of users, and the redline can be set so that a given set of users redlines are visible/hidden. These control methods are:

  1. cvjs_hideAllRedlines_HiddenUsersList() and
  2. cvjs_lockAllRedlines_LockedUsersList().
function cvjs_OnLoadEndRedlines(){
    // generic callback method, called when the redline is loaded
    // here you fill in your stuff, hide specific users and lock specific users
    // this method MUST be retained as a dummy method! - if not implemeted -
    // I am hiding users added to the hide user list
    cvjs_hideAllRedlines_HiddenUsersList();
    // I am freezing users added to the lock user list
    cvjs_lockAllRedlines_LockedUsersList();
}

Click on the method to open the API documentation.

Last updated on 4 Feb 2023
Published on 9 Apr 2020