Gets the drawing context of the 3D model.

syntaxSyntax:
FWiz.Get3DModelCtx()

Return Value

Returns a FWiz3DModel object.

Remarks

The 3D model drawing context is only available in the function in response to the OnBuild3DModel event.

Example

See the TO-220 sample code for the complete script.

  Copy codeCopy code
function OnBuild3DModel()
{
  var A = FWiz.GetValue("A");
  var D = FWiz.GetValue("D");
  var L = FWiz.GetValue("L");
  var L1 = FWiz.GetValue("L1");
  var Q = FWiz.GetValue("Q");
  var F = FWiz.GetValue("F");
  var E = FWiz.GetValue("E");
  var P = FWiz.GetValue("P");
  var H1 = FWiz.GetValue("H1");
  var b = FWiz.GetValue("b");
  var b1 = FWiz.GetValue("b1");
  var c = FWiz.GetValue("c");
  var e = FWiz.GetValue("e");
  var J1 = FWiz.GetValue("J1");
  var tabShape = FWiz.GetValue("BEVELEDTAB") ? -50 : 0;

  var bodyStyle = FWiz.Get3DStyle(0);
  var pinsStyle = FWiz.Get3DStyle(1);

  var m = (A - F) / 2;
  var cx = 0;
  var cy = J1 + c / 2 - A / 2;
  var rectBodyXY = new DlxRect();
  rectBodyXY.SetRect(new DlxPoint(cx, cy), E, A);  

  var zPin = 0;
  var zBody = zPin+L;
  var zMax = zBody+D;
  var zTab = zMax-H1;
  var zHole = zMax-Q;

  var pack = FWiz.Get3DModelCtx();

  // Body
  var shapeBodyYZ = new DlxFigure();
  shapeBodyYZ.BeginShape();
  shapeBodyYZ.AddPoint(zBody, rectBodyXY.top);
  shapeBodyYZ.AddPoint(zBody, rectBodyXY.bottom);
  shapeBodyYZ.AddPoint(zTab - m, rectBodyXY.bottom);
  shapeBodyYZ.AddPoint(zTab, rectBodyXY.bottom + m);
  shapeBodyYZ.AddPoint(zTab, rectBodyXY.top);
  shapeBodyYZ.EndShape(true);

  var body = new DlxSolid(shapeBodyYZ, bodyStyle);
  body.ExtrudeYZ(rectBodyXY.left, E);
  pack.Add(body);

  // Tab
  var shapeTabXZ = new DlxFigure();
  shapeTabXZ.SetRectangle(new DlxPoint(rectBodyXY.left, zTab), rectBodyXY.Width(), zMax - zTab, 0, 0, tabShape, tabShape);

  var tabHoleXZ = new DlxFigure();
  tabHoleXZ.SetCircle(new DlxPoint(cx, zHole), P/2);

  var tab = new DlxSolid(shapeTabXZ, pinsStyle);
  tab.AddHole(tabHoleXZ);
  tab.ExtrudeXZ(rectBodyXY.top-F, F);
  pack.Add(tab);

  // Pins
  var lead = new DlxLead();
  lead.Pin(pinsStyle, b, L-L1, c, b1, L1, 0);
  lead.Rotate(0, 0, 90);
  pack.Add(lead);

  lead = new DlxLead();
  lead.Pin(pinsStyle, b, L-L1, c, b1, L1, 0);
  lead.Rotate(0, 0, 90);
  lead.Move(-e, 0, 0);
  pack.Add(lead);

  lead = new DlxLead();
  lead.Pin(pinsStyle, b, L-L1, c, b1, L1, 0);
  lead.Rotate(0, 0, 90);
  lead.Move(e, 0, 0);
  pack.Add(lead);

  pack.Move(0, 0, -3.6);
}

See also