The shape definition string consists of a series of commands separated by the semicolon character ';'.
A command begins with an alphabetic character and is followed by a list of parameters. The available commands are listed in the following table.
Type | Meaning | Parameters |
---|---|---|
Vx,y,arcFactor; | Adds a new vertex if the value of arcFactor is zero or an arc of a circle if the value of arcFactor is non-zero. If the value of arcFactor is zero it can also be omitted. | x: Horizontal coordinate. y: Vertical coordinate. arcFactor: The value of arcFactor specifies the amplitude of the angle formed by the arc that joins the last vertex of the shape with the vertex specified by x,y. The value is in degrees and must be zero to specify a straight line segment. Positive values mean the arc is drawn counterclockwise. |
Lx1,y1,x2,y2; | Add a line. | x1,y1: Starting point of the line. x2,y2: End point of the line. |
Ax,y,radius,startAngle,endAngle,cw; | Adds an arc of a circle. | x,y: The coordinates specifying the center of the arc. radius: Radius of the arc. startAngle: The angle, in degrees, of the arc start. endAngle: The angle, in degrees, of the end of the arc. cw: Specify 1 to draw the arc clockwise, or 0 to draw the arc counterclockwise. |
Bx1,y1,x2,y2,x3,y3,x4,y4; | Adds a Bézier spline to the shape. | x1,y1: The coordinates of the starting point of the Bézier spline. x2,y2: The coordinates of the first control point of the Bézier spline. x3,y3: The coordinates of the second control point of the Bézier spline. x4,y4: The coordinates of the ending point of the Bézier spline. |
#; | Specifies that the shape is to be closed. |
Example
Copy 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);
}
}
}
|