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())
{
doc.SetStyle(new DlxPenStyle(0.5, "orange"))
var obj = layer.DrawImage(new DlxRect(50,40,120,90));
obj.LoadImage("*");
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);
}
}
}
|