Computes the size of the rectangle enclosing the object.

syntaxSyntax:
DlxObject.GetBoundingBox(bWithStyle = true)

Parameters

Parameter Description
bWithStyle If true, the thickness of the pen is also considered.

Return Value

If the operation ends successfully, it returns a DlxRect object with the bounding rectangle otherwise it returns an empty DlxRect.

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())
    {
      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));
      var bbox = obj.GetBoundingBox();
      DlxApp.Printf("BBox width=%.2f height=%.2f", bbox.Width(), bbox.Height());
    }
  }
}

See also