Gets the coordinates of a corner of the rectangle.

syntaxSyntax:
DlxRectangle.GetCornerPoint(index)

Parameters

Parameter Description
index Specify the corner index. Specify one of the following values:
DlxApp.CORNERINDEX_BOTTOMLEFT
DlxApp.CORNERINDEX_BOTTOMRIGHT
DlxApp.CORNERINDEX_TOPRIGHT
DlxApp.CORNERINDEX_TOPLEFT

Return Value

If the operation is successful, it returns a DlxPoint with the coordinates; otherwise it returns an invalid point. Use IsValid to verify that the point is valid.

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())
    {
      doc.SetStyle(new DlxPenStyle(0.5, "orange"));
      var obj = layer.DrawRectangle(new DlxRect(50,40,120,90), 0, 50, 0, 0, -50);
      DlxApp.Printf("BL corner: %.1f,%.1f", obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMLEFT).x, obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMLEFT).y);
      DlxApp.Printf("BR corner: %.1f,%.1f", obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMRIGHT).x, obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMRIGHT).y);
      DlxApp.Printf("TL corner: %.1f,%.1f", obj.GetCornerPoint(DlxApp.CORNERINDEX_TOPLEFT).x, obj.GetCornerPoint(DlxApp.CORNERINDEX_TOPLEFT).y);
      DlxApp.Printf("TR corner: %.1f,%.1f", obj.GetCornerPoint(DlxApp.CORNERINDEX_TOPRIGHT).x, obj.GetCornerPoint(DlxApp.CORNERINDEX_TOPRIGHT).y);
    }
  }
}

See also