public void CreatePads() { IFilter filter = new IFilter(Parent); IStep curStep = Parent.GetCurrentStep(); if (curStep == null) { MessageBox.Show("No Job loaded, please load a job before start this script!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } IODBLayer fiducialLayer = filter.CreateEmptyODBLayer("copper", curStep.Name); if (fiducialLayer == null) { MessageBox.Show("Can't create new layer!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } float outerDiameter = 1800; float innerDiameter = 1000; int shapeIndex = IFilter.AddToolDefinitionDonut(fiducialLayer, outerDiameter / 25.4f, innerDiameter / 25.4f, 0); PCBI.MathUtils.PointD startLine = new PCBI.MathUtils.PointD(0, 0); float distance = 2540 / 25.4f; for (int y = 0; y < 39; y++) { for (int i = 0; i < 63; i++) { IODBObject pad = filter.CreatePad(fiducialLayer); IPadSpecificsD ps = new IPadSpecificsD(); ps.Location = new PCBI.MathUtils.PointD(startLine.X, startLine.Y); ps.ShapeIndex = shapeIndex; ps.Positive = true; pad.SetSpecifics(ps); startLine.X += distance; } startLine.Y += distance; startLine.X = 0; } IMatrix matrix = Parent.GetMatrix(); matrix.UpdateDataAndList(); Parent.UpdateView(); }
public void Execute(IPCBIWindow parent) { IFilter filter = new IFilter(parent); IStep curStep = parent.GetCurrentStep(); if (curStep == null) { MessageBox.Show("No Job loaded, please load a job before start this script!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } IODBLayer fiducialLayer = filter.CreateEmptyODBLayer("fiducial", curStep.Name); if (fiducialLayer == null) { MessageBox.Show("Can't create new layer!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } int shapeIndex = IFilter.AddToolDefinitionDonut(fiducialLayer, (float)IMath.MM2Mils(2), (float)IMath.MM2Mils(1), -1); IODBObject pad = filter.CreatePad(fiducialLayer); PointD FidPoint = new PointD(IMath.MM2Mils(3), IMath.MM2Mils(3)); pad.SetSpecifics(new IPadSpecificsD() { Location = FidPoint, ShapeIndex = shapeIndex, Positive = true }); IAttributeElement attribute = new IAttributeElement(PCBI.FeatureAttributeEnum.fiducial_name); attribute.Value = "fid1"; IAttribute.SetAttribute(attribute, pad); FidPoint = new PointD(IMath.MM2Mils(3), IMath.MM2Mils(147)); pad = filter.CreatePad(fiducialLayer); pad.SetSpecifics(new IPadSpecificsD() { Location = FidPoint, ShapeIndex = shapeIndex, Positive = true }); attribute = new IAttributeElement(PCBI.FeatureAttributeEnum.fiducial_name); attribute.Value = "fid1"; IAttribute.SetAttribute(attribute, pad); parent.UpdateControlsAndResetView(); }