Gets the number of points that describe the curve.
Syntax: |
---|
DlxCurve.GetPointCount() |
Return Value
Returns the number of points.
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", false);
}
if (doc.IsValid() && doc.Activate())
{
var page = doc.GetActivePage();
if (page.IsValid())
{
var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
if (layer.IsValid())
{
var pos = layer.GetFrontObjectIterator();
while (pos.IsValid())
{
var obj = layer.GetNextObject(pos);
if (obj.GetType() == DlxApp.OBJTYPE_CURVE)
{
// Extends the curve.
var angle = obj.GetPoint(1).ArcAngle(obj.GetStartPoint());
obj.SetPoint(0, obj.GetStartPoint().CirclePoint(20, angle));
angle = obj.GetPoint(obj.GetPointCount()-2).ArcAngle(obj.GetEndPoint());
obj.SetPoint(obj.GetPointCount()-1, obj.GetEndPoint().CirclePoint(20, angle));
// Set the curve thickness to 2mm.
var pen = new DlxPenStyle();
obj.GetStyle(pen);
pen.SetWidth(2);
obj.SetStyle(pen);
DlxApp.Printf("Curve type: %s", obj.GetCurveType() == DlxApp.CURVETYPE_BEZIER ? "Bezier Spline" : "Cardinal Spline");
}
}
}
}
}
|