The Value object is used to specify the style and position of the text that indicates the type of electrical component or the value of the component.
Syntax: |
DlxPage.DrawValue(insertionPoint, 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. |
value |
A string that specifies the value. To insert overlined characters in the text, they must be delimited with the '|' character. |
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 DlxValue object. Call the IsValid() method to determine if the
object was created correctly.
Remarks
The object is created on the Top Legend (DlxApp.LAYERTYPE_TOPSILK) layer. If the layer is not present on the page, the object is not created and this function returns an invalid object.
Example
|
Copy code
|
var prj = DlxApp.GetJob().GetProject("Example Footprints");
if (!prj.IsValid())
prj = DlxApp.GetJob().NewProject("Example Footprints");
var pcbDoc = prj.NewDocument("Examples Footprints", DlxApp.DOCTYPE_PCB);
if (pcbDoc.IsValid() && pcbDoc.Activate())
{
// Initialize the document
pcbDoc.SetPageFormat("A4", true);
var page = pcbDoc.NewPage("DIP14", 0, true);
page.SelectView("Default View");
if (page.LoadLayerStack("footprints library layer stack.clxlys"))
{
// Draw the frame
var hotspotPoint = new DlxPoint(105, 150);
page.DrawFrame(new DlxRect(10,10,200,290), 1, "DIP14", "Dual-in-line 14 leads.");
page.DrawHotspot(hotspotPoint);
var body = new DlxRect();
body.SetCentered(hotspotPoint, 4.5, 18);
page.DrawReference(body.TopLeft(), "U?", 0, DlxApp.TEXTALIGN_BOTTOMLEFT);
page.DrawValue(body.BottomLeft(), "Value", 0, DlxApp.TEXTALIGN_TOPLEFT);
}
}
|
See also