70001512 Export Explode command in WebControl

Article 70001512
Type Wish
Product WebJS
Version 8001
Date Added 4/3/2019
Fixed 8.8002.0.3 (5/6/2019)
Submitted by Davide Andreoli

Summary

Export Explode command in WebControl.

Solution

In version 8002.0.3 ExplodeObjects(object entities) method has been exported which returns an array of the exploded entities of the passed insert.
Note that only entities from vdinsert object are exploded.

In the example bellow we start a new selection and let the user select an insert object and after user has selected the insert we explode all the entities of the insert.
NOTE after explode operation the entities are not exist in the layout and also are not be drawn on the screen.We use the RegisterFigure method which add them in the
entities of the layout and also give them a new handle.After all this operation we can see that if a block contains for example three items after the explode we will have four item.
Three from the block and the insert which we can delete it if we want to get only the entities from the insert.

          vdcanvas.scriptCommand.select(null, _myselectCallback);
           
          function _myselectCallback(vdcanvas) { 
          
            var selectedEntities = vdcanvas.scriptCommand.ActiveSelection();//get the insert from the selection of the user
            var objs = vdcanvas.ExplodeObjects(selectedEntities);
            for (var k = 0; k < objs.length; k++) {
                var entity = objs[k];
                vdcanvas.scriptCommand.RegisterFigure(entity, true, true);//register all the entities of the block the the layout               
            }           
            var ins = vdcanvas.GetEntityItem("h_117");//find the insert from its handle
            ins.Deleted = true;//delete the insert
            vdcanvas.redraw();

          }

Send comments on this topic.