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())
{
// create objects
var pen = new DlxPenStyle(0.5, new DlxColor("orangered"), "DASHED");
doc.SetStyle(pen);
var obj = layer.DrawLine(new DlxPoint(30, 30), new DlxPoint(80, 80));
// moves object
var dlg = new DlxDialog(200, 120, "Move");
if (dlg.IsValid())
{
dlg.AddStaticText(20, 23, 60, "dx:");
var dx = dlg.AddEditNumber(90, 20, 100, DlxApp.DIALOGEDITNUMBER_LENGTH, 0, -100, 100);
dlg.AddStaticText(20, 48, 60, "dy:");
var dy = dlg.AddEditNumber(90, 45, 100, DlxApp.DIALOGEDITNUMBER_LENGTH, 0, -100, 100);
dlg.AddOkButton(80, 80, 50, 25);
dlg.AddCancelButton(140, 80, 50, 25);
if (dlg.DoModal())
{
obj.Move(dx.GetNumber(), dy.GetNumber());
}
}
}
}
}
|