Creates an aligned dimension object.
Syntax: |
---|
DlxLayer.DrawAlignedDimension(p1, p2, height, textPos = 0) |
Parameters
Parameter | Description |
---|---|
p1 | A DlxPoint object with the coordinates specifying the first endpoint of the extension line. |
p2 | A DlxPoint object with the coordinates specifying the second endpoint of the extension line. |
height | Height of the dimension line. Measured from point p1. |
textPos | Specifies the position of the text. A value less than zero moves the text away from point p1. A value greater than zero moves the text away from point p2. A value of zero places the text in the center of the dimension line. |
Return Value
The newly created DlxDimension object. Call the IsValid() method to determine if the object was created correctly.
Remarks
In aligned dimensions, the dimension line is parallel to the extension line origins. The extension line origins are specified using the p1 and p2 parameters.
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())
{
var p1 = new DlxPoint(50, 50);
var p2 = new DlxPoint(100, 100);
layer.DrawLine(p1, p2);
layer.DrawAlignedDimension(p1, p2, 10);
}
}
}
|