This event is raised when the 2D image of the component is requested.
Syntax: |
---|
function OnBuild2DImage() |
Remarks
The purpose of this function is to create all the graphic objects that make up the graphic image of the component.
Example
See the TO-220 sample code for the complete script.
Copy code | |
---|---|
function OnBuild2DImage()
{
var A = FWiz.GetValue("A");
var J1 = FWiz.GetValue("J1");
var c = FWiz.GetValue("c");
var E = FWiz.GetValue("E");
var F = FWiz.GetValue("F");
var ctx = FWiz.Get2DImageCtx();
var rect = new DlxRect();
var y = J1 + c / 2 - A / 2;
// body
ctx.SetPenStyle(0);
ctx.SetBrushStyle(0);
rect.SetRect(new DlxPoint(0,y), E, A);
ctx.BeginGroup("Body");
ctx.DrawRectangle(rect);
ctx.EndGroup();
// tab
ctx.SetBrushStyle(1);
rect.bottom = rect.top - F;
ctx.BeginGroup("Tab");
ctx.DrawRectangle(rect);
ctx.EndGroup();
}
|