%%PageItemTitle%%

VectorDraw Web Library

JsPropertiesExtractor Send comments on this topic.
rotate Method
See Also  Example
vdWebLibrary Namespace > ScriptCommands Class : rotate Method
originPoint
A point in world CS or undefined for user prompt
rotation
A rotation angle in radians or undefined for user prompt
callback
A ScriptSelectDelegate user defined function that will be called when the command finish
rotate the passed entities around a point reference in worldcs with passed angle in radians. It also write to UndoHistory and script buffer

Syntax

JScript 
public function rotate( 
   originPoint : Object,
   rotation : double,
   callback : ScriptSelectDelegate
);

Parameters

originPoint
A point in world CS or undefined for user prompt
rotation
A rotation angle in radians or undefined for user prompt
callback
A ScriptSelectDelegate user defined function that will be called when the command finish

Example

C#Copy Code
//1. prompt the user for selection 
  vdrawObj.scriptCommand.select(null,function (_vdcanvas) { _vdcanvas.scriptCommand.rotate(); } ); 
//2. No user prompt do this action for all active layout entities 
           var entities = []; 
           var layout = vdcanvas.GetActiveLayout(); 
           for (var i = 0; i < layout.Entities.Items.length; i++) { 
               var h = layout.Entities.Items[i]; 
               fig = vdrawObj.GetEntityItem(h); 
               entities.push(fig); 
           } 
           vdrawObj.scriptCommand.select(entities,function (_vdcanvas) { _vdcanvas.scriptCommand.rotate([0,0,0],vdgeo.PI);});//rotate around 0,0  180 degrees

See Also