Beispiel #1
0
 public void Execute(IPCBIWindow parent)
 {
     //your code here
     foreach (ICMPObject cmp in parent.GetCurrentStep().GetSelectedCMPs())
     {
         if (!packageListClassifier.ContainsKey(cmp.UsedPackageName))
         {
             packageListClassifier.Add(cmp.UsedPackageName, cmp.UsedPackageName);
             IPackageSpecificsD pack     = cmp.GetPackageSpecificsD();
             ISurfaceSpecificsD ps       = pack.GetPackageSurfaceSpecificsD();
             IPolyClass         packPoly = ps.GetIPolyClass();
             packPoly.AddOversize(IMath.MM2Mils(0.2)); // Oversize can also be negative
             pack.SetOutline(packPoly);
         }
     }
     parent.UpdateView();
 }
        private void SetOriginBotLeft(IPCBIWindow parent)
        {
            IStep              step           = parent.GetCurrentStep();
            IMatrix            PCB_Matrix     = parent.GetMatrix();
            IODBObject         profile        = step.GetPCBOutlineAsODBObject();
            ISurfaceSpecificsD profileSurface = (ISurfaceSpecificsD)profile.GetSpecificsD();;

            RectangleD profileRect = profileSurface.GetBounds();
            PointD     OriginPoint = new PointD(-profileRect.Left, -profileRect.Top);;

            foreach (string layerName in PCB_Matrix.GetAllBoardLayerNames(true))
            {
                step.GetLayer(layerName).MoveLayer(OriginPoint.ToPointF());
            }
            profile.SetOffset(OriginPoint);

            parent.UpdateView();
        }
            private void CreateNewDrillODBLayer(PCBI.Automation.IFilter filter, string newLayerName, IPCBIWindow parent, List <IODBObject> currIODBObjectList, bool activateLayer)
            {
                if (currIODBObjectList.Count == 0)
                {
                    return;
                }

                IODBLayer layer = filter.CreateEmptyODBLayer(newLayerName, parent.GetCurrentStep().Name);
                Dictionary <string, int> shapeList = new Dictionary <string, int>();

                foreach (IODBObject obj in currIODBObjectList)
                {
                    if (obj.Type == IObjectType.Pad)
                    {
                        IPadSpecificsD specPad = (IPadSpecificsD)obj.GetSpecificsD();
                        if (!shapeList.ContainsKey(specPad.ODBSymbol_String))
                        {
                            int newShapeIndex = IFilter.AddToolFromODBString(layer, specPad.ODBSymbol_String, shapeList.Count);
                            shapeList.Add(specPad.ODBSymbol_String, newShapeIndex);
                        }
                        IODBObject     pad       = filter.CreatePad(layer);
                        IPadSpecificsD padInfosD = (IPadSpecificsD)obj.GetSpecificsD();
                        padInfosD.ShapeIndex = shapeList[specPad.ODBSymbol_String];
                        pad.SetSpecifics(padInfosD, shapeList[specPad.ODBSymbol_String]);
                    }
                    else if (obj.Type == IObjectType.Line)
                    {
                        ILineSpecificsD specLine = (ILineSpecificsD)obj.GetSpecificsD();
                        if (!shapeList.ContainsKey(specLine.ODBSymbol_String))
                        {
                            int newShapeIndex = IFilter.AddToolFromODBString(layer, specLine.ODBSymbol_String, shapeList.Count);
                            shapeList.Add(specLine.ODBSymbol_String, newShapeIndex);
                        }
                        IODBObject      line           = filter.CreateLine(layer);
                        ILineSpecificsD lineSpecificsD = (ILineSpecificsD)obj.GetSpecificsD();
                        lineSpecificsD.ShapeIndex = shapeList[specLine.ODBSymbol_String];
                        line.SetSpecifics(lineSpecificsD);
                    }
                    else if (obj.Type == IObjectType.Arc)
                    {
                        IArcSpecificsD specArc = (IArcSpecificsD)obj.GetSpecificsD();
                        if (!shapeList.ContainsKey(specArc.ODBSymbol_String))
                        {
                            int newShapeIndex = IFilter.AddToolFromODBString(layer, specArc.ODBSymbol_String, shapeList.Count);
                            shapeList.Add(specArc.ODBSymbol_String, newShapeIndex);
                        }
                        IODBObject     arc           = filter.CreateArc(layer);
                        IArcSpecificsD specificsArcD = (IArcSpecificsD)obj.GetSpecificsD();
                        specificsArcD.ShapeIndex = shapeList[specArc.ODBSymbol_String];
                        arc.SetSpecifics(specificsArcD);
                    }
                    else if (obj.Type == IObjectType.Surface)
                    {
                        IODBObject         surface           = filter.CreatePolygon(layer);
                        ISurfaceSpecificsD surfaceSpecificsD = (ISurfaceSpecificsD)obj.GetSpecificsD();
                        surface.SetSpecifics(surfaceSpecificsD);
                    }
                    else if (obj.Type == IObjectType.Text)
                    {
                        IODBObject      text           = filter.CreateText(layer);
                        ITextSpecificsD textSpecificsD = (ITextSpecificsD)obj.GetSpecificsD();
                        text.SetSpecifics(textSpecificsD);
                    }
                }
                if (activateLayer)
                {
                    layer.EnableLayer(true);
                }

                IMatrix matrix = parent.GetMatrix();

                matrix.SetMatrixLayerType(layer.LayerName, MatrixLayerType.Drill);
                matrix.SetMatrixLayerContext(layer.LayerName, MatrixLayerContext.Board);
            }