Method CmdScale
- Namespace
- vdWebLibrary
- Assembly
- JsPropertiesExtractor.dll
CmdScale(object, object, double, CmdScriptCallback)
Scales an array of vdraw entities. Check the function finished throw the passed scriptCallBack delegate
public void CmdScale(object entities, object referencePoint, double scale, CmdScriptCallback scriptCallBack = null)
Parameters
entitiesobjectAn array of vdraw entities or null so the user can pick the objects on screen.
referencePointobjectA reference point object in World coordinates or null so the user can pick this point on screen. This point will be used as scale base point.
scaledoubleThe scale to be used for the command or null in order for the user to select it on screenuser can set a double variable of scale for all X,Y,Z scale 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 .
scriptCallBackCmdScriptCallbackOptional.A delegate of CmdScriptCallback type to be fired when the user action finish
Examples
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
Remarks
This command does not write to UndoHistory() and Script buffer. In order to do that use the scriptCommand.scale(object, double, ScriptSelectDelegate)