Gets the coordinates of a vertex of the image frame.
Syntax: |
DlxShoot.GetCornerPoint(index)
|
Parameters
Parameter |
Description |
index |
Specify the corner index. Specify one of the following values:
DlxApp.CORNERINDEX_BOTTOMLEFT |
DlxApp.CORNERINDEX_BOTTOMRIGHT |
DlxApp.CORNERINDEX_TOPRIGHT |
DlxApp.CORNERINDEX_TOPLEFT |
|
Return Value
If the operation is successful, it returns a DlxPoint with the
coordinates; otherwise it returns an invalid point. Use IsValid to verify that the point is valid.
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_SHOOT)
{
obj.Rotate(45);
DlxApp.Printf("Rotation angle: %.1f", obj.GetRotation());
DlxApp.Printf("BL corner: %.1f,%.1f", obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMLEFT).x, obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMLEFT).y);
DlxApp.Printf("BR corner: %.1f,%.1f", obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMRIGHT).x, obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMRIGHT).y);
DlxApp.Printf("TL corner: %.1f,%.1f", obj.GetCornerPoint(DlxApp.CORNERINDEX_TOPLEFT).x, obj.GetCornerPoint(DlxApp.CORNERINDEX_TOPLEFT).y);
DlxApp.Printf("TR corner: %.1f,%.1f", obj.GetCornerPoint(DlxApp.CORNERINDEX_TOPRIGHT).x, obj.GetCornerPoint(DlxApp.CORNERINDEX_TOPRIGHT).y);
}
}
}
}
}
|
See also