A graphical attribute is a text identified by a name. Attributes allow you to enter information and data into symbols.
Syntax: |
DlxLayer.DrawAttribute(insertionPoint, name, category, value, rotationAngle = 0, alignment = DlxApp.TEXTALIGN_DEFAULT)
|
Parameters
Parameter |
Description |
insertionPoint |
A DlxPoint object with the coordinates on the drawing where the text is placed. |
name |
A string that specifies the name of the attribute. |
category |
A string that specifies the name of the attribute.
For each attribute, the category to which it belongs must be indicated. The following categories are predefined: OBJECT, SHAPE, SPICE, DEVICE, PACKAGE. |
value |
A string that specifies the attribute value. To insert overlined characters in the text, they must be delimited with the '|' character. Ex: P1/|P2| |
rotationAngle |
The angle, in degrees, of rotation of the text with respect to the x-axis. |
alignment |
Specifies the horizontal and vertical alignment of the text with respect to the insertion point.
Enter the following values:
Vertical |
DlxApp.TEXTALIGN_TOP |
DlxApp.TEXTALIGN_MIDDLE |
DlxApp.TEXTALIGN_BASE |
DlxApp.TEXTALIGN_BOTTOM |
Horizontal |
DlxApp.TEXTALIGN_LEFT |
DlxApp.TEXTALIGN_CENTER |
DlxApp.TEXTALIGN_RIGHT |
DlxApp.TEXTALIGN_COMMA |
DlxApp.TEXTALIGN_JUSTIFY |
Vertical & Horizontal |
DlxApp.TEXTALIGN_TOPLEFT |
DlxApp.TEXTALIGN_TOPCENTER |
DlxApp.TEXTALIGN_TOPRIGHT |
DlxApp.TEXTALIGN_TOPJUSTIFY |
DlxApp.TEXTALIGN_MIDDLELEFT |
DlxApp.TEXTALIGN_MIDDLECENTER |
DlxApp.TEXTALIGN_MIDDLERIGHT |
DlxApp.TEXTALIGN_MIDDLEJUSTIFY |
DlxApp.TEXTALIGN_BASELEFT |
DlxApp.TEXTALIGN_BASECENTER |
DlxApp.TEXTALIGN_BASERIGHT |
DlxApp.TEXTALIGN_BASEJUSTIFY |
DlxApp.TEXTALIGN_BOTTOMLEFT |
DlxApp.TEXTALIGN_BOTTOMCENTER |
DlxApp.TEXTALIGN_BOTTOMRIGHT |
DlxApp.TEXTALIGN_BOTTOMJUSTIFY |
Current alignment |
DlxApp.TEXTALIGN_DEFAULT |
|
Return Value
The last newly created DlxAttribute object. Call the IsValid() method to determine if the
object was created correctly.
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())
{
layer.DrawAttribute(new DlxPoint(90,100), "Part number", "Manufacturer", "PN001");
}
}
}
|
See also