CADViewer Technical Documentation, Installation Guide and Reference Samples Library

API controls for Load/Save

API Controlled Redlines Load/Save

When using direct control of redline load/save then the first step is to uncomment the redline modal settings in the initalization part of the document.

There are two methods that triggers direct load/save of redlines when the Redline Modal is activated. These methods are: cvjs_setStickyNoteRedlineUrl() for Load and cvjs_setStickyNoteSaveRedlineUrl() for Save. The Redlines files are .js files, where the redlines content is kept in a Java Script structure.

// NOTE BELOW: THESE SETTINGS ARE FOR SERVER CONTROLS FOR UPLOAD OF REDLINES
// If the redline load/save is application controlled, the user will set the load/save files using the following methods:
cvjs_setStickyNoteRedlineUrl("../redlines/filename-red_t1.js");
cvjs_setStickyNoteSaveRedlineUrl("../redlines/filename-red_s1.js");
// Redines folder location is
// Redlines folder location used when file-manager is used for upload and redline selection
//cvjs_setRedlinesRelativePath('../redlines/demo_red/', ServerLocation+'/redlines/demo_red/');
//cvjs_setRedlinesAbsolutePath(ServerUrl+'content/redlines/fileloader_610/', ServerLocation+'content/redlines/fileloader_610/');
// NOTE ABOVE: THESE SETTINGS ARE FOR SERVER CONTROLS FOR UPLOAD OF REDLINES

Click on the method to open the API documentation.

There are two API methods exposed to application programmers that controls what action takes place when the Redlines Load icon and Redlines Save icon are pushed, cvjs_saveStickyNotesRedlinesUser() and cvjs_loadStickyNotesRedlinesUser().

The content of these methods are open to edit, in the standard setup, they are set up to trigger load and save via the Redline Modal using the methods: cvjs_openRedlineSaveModal() and cvjs_openRedlineLoadModal().

/// NOTE: BELOW REDLINE SAVE LOAD CONTROLLERS
// This method is linked to the save redline icon in the imagemap
function cvjs_saveStickyNotesRedlinesUser(){
// there are two modes, user handling of redlines
// alternatively use the build in redline file manager
cvjs_openRedlineSaveModal("floorPlan");
// custom method startMethodRed to set the name and location of redline to save
// see implementation below
//startMethodRed();
// API call to save stickynotes and redlines
//cvjs_saveStickyNotesRedlines("floorPlan");
}
// This method is linked to the load redline icon in the imagemap
function cvjs_loadStickyNotesRedlinesUser(){
cvjs_openRedlineLoadModal("floorPlan");
// first the drawing needs to be cleared of stickynotes and redlines
//cvjs_deleteAllStickyNotes();
//cvjs_deleteAllRedlines();
// custom method startMethodRed to set the name and location of redline to load
// see implementation below
// startMethodRed();
// API call to load stickynotes and redlines
//cvjs_loadStickyNotesRedlines("floorPlan");
}
/// NOTE: ABOVE REDLINE SAVE LOAD CONTROLLERS

Click on the method to open the API documentation.

Application programmers will comment out the standard modal load and save and replace it with their own coding, this coding should contain settings of Load and Save path for the Redlines.

// This method is linked to the save redline icon in the imagemap
function cvjs_saveStickyNotesRedlinesUser(){
// there are two modes, user handling of redlines
// alternatively use the build in redline file manager
// cvjs_openRedlineSaveModal("floorPlan");
// custom method startMethodRed to set the name and location of redline to save
// see implementation below
startMethodRed();
// API call to save stickynotes and redlines
cvjs_saveStickyNotesRedlines("floorPlan");
}
// This method is linked to the load redline icon in the imagemap
function cvjs_loadStickyNotesRedlinesUser(){
// there are two modes, user handling of redlines
// alternatively use the build in redline file manager
// cvjs_openRedlineLoadModal("floorPlan");
// first the drawing needs to be cleared of stickynotes and redlines
//cvjs_deleteAllStickyNotes();
//cvjs_deleteAllRedlines();
// custom method startMethodRed to set the name and location of redline to load
// see implementation below
startMethodRed();
// API call to load stickynotes and redlines
cvjs_loadStickyNotesRedlines("floorPlan");
}
// Application programmer use this method to fetch load and save path of Redlines
function startMethodRed(){
var v1 = $('#load_redline_url').val();
var v2 = $('#save_redline_url').val();
cvjs_setStickyNoteRedlineUrl(v1);
cvjs_setStickyNoteSaveRedlineUrl(v2);
}

Click on the method to open the API documentation.

Last updated on 31 May 2022
Published on 9 Apr 2020