70001522 Add X,Y,Z scale in current scale commands

Article 70001522
Type Wish
Product WebJS
Version 8001
Date Added 4/17/2019 12:00:00 AM
Fixed 8.8002.0.3 (4/18/2019 12:00:00 AM)
Submitted by Brendan Fry

Summary

Add X,Y,Z scale in current scale commands

Solution

In version 8002.0.4 user has the ability to set separately the X,Y,Z scale through CmdScale and scriptCommand.scale commands.
By now user can set a double variable of scale for all X,Y,Z scale like: vdcanvas.CmdScale(ents, center,2.0) or to set an array of four(4) doubles where the first used for X scale,
the second for Y scale,the third for Z scale and the fourth one must be always 0 when user wants to achieve separately scale like: vdcanvas.CmdScale(ents, center,[-1.0,1.0,1.0,0])
Example: Bellow there is an example where we get all the entities of the layout and we flip(mirror) them around the X axis.

  
           var ents = [];
           var layout = vdcanvas.GetActiveLayout();
           for (var i = 0; i < layout.Entities.Items.length; i++) {
                var h = layout.Entities.Items[i];//the handle of each entity
                var entity = vdcanvas.GetEntityItem(h);
                ents.push(entity);
           }
       
          var box = vdcanvas.GetEntityBBox(ents);//the bounding box of all entities

         if (box) {//if the entity exist
             var pt1 = vdgeo.newpoint(box[0], box[1], box[2]); // The lower left point of the bounding box 
             var pt2 = vdgeo.newpoint(box[3], box[4], box[5]); // The upper right point of the bounding box 
             var center = vdgeo.MidPoint(pt1, pt2); // The middle point between lower left and upper right point of the bounding box 
         }
         vdcanvas.CmdScale(ents, center,[-1.0,1.0,1.0,0])//through CmdScale command
         //vdcanvas.scriptCommand.select(ents, function (_vdcanvas) { _vdcanvas.scriptCommand.scale(center,[- 1.0,1.0,1.0,0.0]); }); //through scriptCommand.scale command

Send comments on this topic.