Rotates an object around a base point.

syntaxSyntax:
DlxObject.Rotate(angle)
DlxObject.Rotate(angle, basePoint)

Parameters

Parameter Description
angle The angle in degrees to rotate the object.
basePoint A DlxPoint coordinates specifying the base point.

Return Value

If the operation ends correctly it returns true otherwise it returns false.

Remarks

The object rotates around the base point. If the base point is not specified, the transformation is performed with respect to the object hotspot.

Example

  Copy codeCopy code
var prj = DlxApp.GetJob().GetProject("Example Sch");
if (!prj.IsValid())
  prj = DlxApp.GetJob().NewProject("Example Sch");
var doc = prj.GetDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
if (!doc.IsValid())
{
  doc = prj.NewDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
  doc.SetPageFormat("A4", false);
}
if (doc.IsValid() && doc.Activate())
{
  var page = doc.GetActivePage();
  if (page.IsValid())
  {
    var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
    if (layer.IsValid())
    {
      // create objects
      var pen = new DlxPenStyle(0.5, new DlxColor("orangered"), "DASHED");
      doc.SetStyle(pen);
      var obj = layer.DrawLine(new DlxPoint(30, 30), new DlxPoint(80, 80));
       // rotate object
      var dlg = new DlxDialog(200, 120, "Rotate");
      if (dlg.IsValid())
      {
        dlg.AddStaticText(20, 23, 60, "angle:");
        var angle = dlg.AddEditNumber(90, 20, 100, DlxApp.DIALOGEDITNUMBER_ANGLE, 0, 0, 360);
        dlg.AddOkButton(80, 80, 50, 25);
        dlg.AddCancelButton(140, 80, 50, 25);
        if (dlg.DoModal())
        {
          obj.Rotate(angle.GetNumber());
        }
      }
    }
  }
}

See also