70000915 Method to Add a Layout and viewport

Article 70000915
Type Wish
Product WebJS
Version 7009
Date Added 10/26/2016 12:00:00 AM
Fixed 7.7010.0.1 (10/26/2016 12:00:00 AM)
Submitted by Ilan Sandor

Summary

Method to Add a Layout and viewport

Solution

In version 7010.0.1

AddLayout and AddViewport methods was added to VectorDraw web control:

Example:


var vdcanvas = vdmanager.vdrawObject(canvasId);
           //add a new empty layout to document with name "test" and return the Layout index id
           //if layout already exist then returns the existing layout index id.
           //Warning: the passed layout name must not be 'model' or equal to the document.Model name
           var layoutid = vdcanvas.AddLayout("test");

            //set the new created layout as active
            vdcanvas.SetActiveLayoutId(layoutid);

            //add a new viewport to the active layout and returns the viewport object 
            //if the document model layout is active no viewport is created.
            
            vdcanvas.AddViewport([0, 0, 0], //lower left insertion point of viewport rectangle
                                             10,//width of viewport in drawing units
                                             10,//height of viewport in drawing units
                                             [21133.0213, 613.6096, 0.0000], //view center of viewport relative to document model layout.NOTE:set it to undefine in order to automaticaly get the document model extents center point
                                             364.6769, //view size of viewport in drawing units relative  to document model layout..NOTE:set it to undefine in order to automaticaly get the document model extents height
                                             true ..
                                           );
            //zoom to extents and redraw the active layout
            vdcanvas.zoomExtents();
            setTimeout(Redraw, 50);

Send comments on this topic.