Create a shape consisting of lines, curves, and arcs.

syntaxSyntax:
DlxLayer.DrawShape()
DlxLayer.DrawShape(shape)
DlxLayer.DrawShape(shapeDef)

Parameters

Parameter Description
shape A DlxFigure object with the shape.
shapeDef String with the definition of the shape. For more information, see Shape Format Specifications.

Return Value

The last newly created DlxShape object. Call the IsValid() method to determine if the object was created correctly.

Remarks

If the definition string is not provided an empty shape is created. Call GetFigure to start building a new shape then draw the individual segments by calling the following methods: AddArc, AddBezier, AddCurve, AddLine, AddPoint, AddPoints. When you have finished drawing the shape, end the construction by calling the EndShape method.

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", true);
}
if (doc.IsValid() && doc.Activate())
{
  var page = doc.GetActivePage();
  if (page.IsValid())
  {
    var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
    if (layer.IsValid())
    {
      // draw shape
      layer.DrawShape("V90,110,0;V110,130,0;V130,110,0;V90,110,-120;");
      
      // draw shape
      var andShape = layer.DrawShape();
      var figure = andShape.GetFigure();
      figure.BeginShape();
      figure.AddPoint(new DlxPoint(95,153.75));
      figure.AddPoint(new DlxPoint(101.25,153.75));
      figure.AddPoint(new DlxPoint(101.25,146.25), -180);
      figure.AddPoint(new DlxPoint(95,146.25));
      figure.EndShape(true);       
    }
  }
}

See also