Sets the size and position of the rectangle.
Syntax: |
---|
DlxRectangle.SetRectangle(rect) DlxRectangle.SetRectangle(x, y, width, height) DlxRectangle.SetRectangle(point, width, height) |
Parameters
Parameter | Description |
---|---|
rect | A DlxRect object that specify the rectangle. |
x | Horizontal position of the bottom left corner of the rectangle. |
y | Vertical position of the bottom left corner of the rectangle. |
width | A positive value that defines the width of the rectangle. |
height | A positive value that defines the height of the rectangle. |
point | A DlxPoint object with coordinates specifying the lower left corner of the rectangle. |
Return Value
If the operation ends correctly it returns true otherwise it returns false.
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())
{
doc.SetStyle(new DlxPenStyle(0.5, "orange"));
var obj = layer.DrawRectangle(new DlxRect(50,40,120,90), 0, 50, 0, 0, -50);
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);
obj.SetRectangle(60, 80, 120, 100);
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);
}
}
}
|