Set the tolerance values.

syntaxSyntax:
DlxDimension.SetTolerance(mode, pos, neg)

Parameters

Parameter Description
mode Enter one of the following values:
DlxApp.TOLERANCEMODE_NONE
DlxApp.TOLERANCEMODE_BYSTYLE
DlxApp.TOLERANCEMODE_RELATIVE
DlxApp.TOLERANCEMODE_ABSOLUTE
pos The positive tolerance value or DlxApp.TOLERANCEVALUE_BYSTYLE if the positive tolerance value is to be taken from the style.
neg The negative tolerance value or DlxApp.TOLERANCEVALUE_BYSTYLE if the negative tolerance value is to be taken from the style.

Return Value

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

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 p1 = new DlxPoint(50, 50);
      var p2 = new DlxPoint(100, 100);
      layer.DrawLine(p1, p2);
      var obj = layer.DrawAlignedDimension(p1, p2, 10);

      if (obj.GetToleranceMode()==DlxApp.TOLERANCEMODE_BYSTYLE)
      {
        obj.SetTextFormat("@V@U@T");
        obj.SetTolerance(DlxApp.TOLERANCEMODE_RELATIVE, 
           obj.GetTolerancePos()==DlxApp.TOLERANCEVALUE_BYSTYLE ? 0.5 : obj.GetTolerancePos(), 
           obj.GetToleranceNeg()==DlxApp.TOLERANCEVALUE_BYSTYLE ? -0.3 : obj.GetToleranceNeg());
      }
    }
  }
}

See also