Sets the shape of the corners of the rectangle.
Syntax: |
DlxRectangle.SetCorner(index, mode, factor)
|
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 |
|
mode |
Specifies the shape of the corner. Specify one of the following values:
DlxApp.CORNERTYPE_ROUNDED |
DlxApp.CORNERTYPE_BEVELED |
DlxApp.CORNERTYPE_SCALLOPED |
|
factor |
The dimensions of the angle should be indicated as a percentage. Values between 0 and 100.
The value of 0% indicates that the corners of the rectangle are at 90°. |
Return Value
If the operation ends correctly it returns true otherwise it returns false.
Remarks
To draw rectangles or squares with rounded, scalloped or blunted corners, you must specify the size of the angle.
To round or scallop an angle, the angle dimensions determine the radius of the angle.
The radius is measured from the center of the curve to its perimeter. Higher values produce more rounded or blunted corners.
The size value for beveling an angle represents the distance for setting the starting point of the bevel to the original angle. Higher values produce a longer beveled edge.
The dimensions of the angle should be indicated as a percentage. Values between 0 and 100.
The value of 0% indicates that the corners of the rectangle are at 90°.
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: %s(%.1f)", obj.GetCornerType(DlxApp.CORNERINDEX_BOTTOMLEFT)==DlxApp.CORNERTYPE_BEVELED ? "BEVELED" :
obj.GetCornerType(DlxApp.CORNERINDEX_BOTTOMLEFT)==DlxApp.CORNERTYPE_SCALLOPED ? "SCALLOPED" : "ROUNDED",
obj.GetCornerFactor(DlxApp.CORNERINDEX_BOTTOMLEFT));
DlxApp.Printf("BR corner: %s(%.1f)", obj.GetCornerType(DlxApp.CORNERINDEX_BOTTOMRIGHT)==DlxApp.CORNERTYPE_BEVELED ? "BEVELED" :
obj.GetCornerType(DlxApp.CORNERINDEX_BOTTOMRIGHT)==DlxApp.CORNERTYPE_SCALLOPED ? "SCALLOPED" : "ROUNDED",
obj.GetCornerFactor(DlxApp.CORNERINDEX_BOTTOMRIGHT));
DlxApp.Printf("TL corner: %s(%.1f)", obj.GetCornerType(DlxApp.CORNERINDEX_TOPLEFT)==DlxApp.CORNERTYPE_BEVELED ? "BEVELED" :
obj.GetCornerType(DlxApp.CORNERINDEX_TOPLEFT)==DlxApp.CORNERTYPE_SCALLOPED ? "SCALLOPED" : "ROUNDED",
obj.GetCornerFactor(DlxApp.CORNERINDEX_TOPLEFT));
DlxApp.Printf("TR corner: %s(%.1f)", obj.GetCornerType(DlxApp.CORNERINDEX_TOPRIGHT)==DlxApp.CORNERTYPE_BEVELED ? "BEVELED" :
obj.GetCornerType(DlxApp.CORNERINDEX_TOPRIGHT)==DlxApp.CORNERTYPE_SCALLOPED ? "SCALLOPED" : "ROUNDED",
obj.GetCornerFactor(DlxApp.CORNERINDEX_TOPRIGHT));
obj.SetCorner(DlxApp.CORNERINDEX_TOPRIGHT, DlxApp.CORNERTYPE_SCALLOPED, 50);
DlxApp.Printf("TR corner: %s(%.1f)", obj.GetCornerType(DlxApp.CORNERINDEX_TOPRIGHT)==DlxApp.CORNERTYPE_BEVELED ? "BEVELED" :
obj.GetCornerType(DlxApp.CORNERINDEX_TOPRIGHT)==DlxApp.CORNERTYPE_SCALLOPED ? "SCALLOPED" : "ROUNDED",
obj.GetCornerFactor(DlxApp.CORNERINDEX_TOPRIGHT));
}
}
}
|
See also