public void Execute(IPCBIWindow parent)
        {
            IMatrix m    = parent.GetMatrix();
            IStep   step = parent.GetCurrentStep();


            foreach (ICMPObject comp in step.GetAllCMPObjects())
            {
                IPackageSpecificsD pack     = comp.GetPackageSpecificsD();
                RectangleD         rectBody = pack.GetBodyBounds();
                RectangleD         rect     = pack.GetBounds();
                comp.AddComponentAttribute("Body_Width", rectBody.Width.ToString());
                comp.AddComponentAttribute("Body_Height", rectBody.Height.ToString());
                // rect = GetPinBounds(comp);
                comp.AddComponentAttribute("Pin_Width", rect.Width.ToString());
                comp.AddComponentAttribute("Pin_Height", rect.Height.ToString());
                comp.AddComponentAttribute("Pin_Area", (rect.Height * rect.Width).ToString());
                //   if(comp.GetPinList().Count == 2)
                // {
                //   string shouldBe = GetGeometrieName(rect.Height * rect.Width);
                //  comp.AddComponentAttribute("Geometry_Calculated", shouldBe );
                // }
            }

            parent.UpdateView();
        }
예제 #2
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 static void CreateComponents(bool top, ICMPLayer CMPLayer, IODBLayer frontLayer, IODBLayer sideLayer, float offset, IFilter filter, bool allValuesInMM)
        {
            if (CMPLayer == null)
            {
                return;
            }
            foreach (ICMPObject component in CMPLayer.GetAllLayerObjects())
            {
                float height = (float)component.CompHEIGHT;
                IPackageSpecificsD usedPackage = component.GetPackageSpecificsD();
                if (height == 0)
                {
                    height = usedPackage.Height;
                }
                if (height == 0)
                {
                    #region check height
                    //check attributes
                    foreach (string attrib in component.GetComponentAttributes())
                    {
                        if (attrib.ToLowerInvariant().Contains("height"))
                        {
                            string[] attribtValueFinder = attrib.Split('=');

                            if (attribtValueFinder.Length > 1)
                            {
                                float.TryParse(attribtValueFinder[1], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out height);
                            }
                            else if (attribtValueFinder[0].Contains("\'"))
                            {
                                string subStr = attribtValueFinder[0].Substring(attribtValueFinder[0].IndexOf('\'') + 1);
                                if (subStr.Contains("\'"))
                                {
                                    subStr = subStr.Substring(0, subStr.IndexOf('\''));
                                    float.TryParse(subStr, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out height);
                                }
                            }
                        }
                    }
                    #endregion
                }
                if (allValuesInMM)
                {
                    height = (float)IMath.MM2Mils(height);
                }

                #region front layer
                int componentFront = IFilter.AddToolDefinitionRect(frontLayer, (float)component.Bounds.Width, height, (float)component.Bounds.Width, false);

                IODBObject cmpFront = filter.CreatePad(frontLayer);

                IPadSpecificsD padCMPFront = (IPadSpecificsD)cmpFront.GetSpecificsD();

                if (top)
                {
                    padCMPFront.Location = new PointD(component.Bounds.X + component.Bounds.Width / 2, offset + height / 2);
                }
                else
                {
                    padCMPFront.Location = new PointD(component.Bounds.X + component.Bounds.Width / 2, -(offset + height / 2));
                }

                cmpFront.SetSpecifics(padCMPFront, componentFront);
                cmpFront.FreeText = component.Ref;
                if (top)
                {
                    cmpFront.ObjectColorTemporary(Color.Silver);
                }
                else
                {
                    cmpFront.ObjectColorTemporary(Color.Gray);
                }
                #endregion
                #region side layer
                int componentSide = IFilter.AddToolDefinitionRect(sideLayer, (float)component.Bounds.Height, (float)component.Bounds.Height, height, false);

                IODBObject cmpSide = filter.CreatePad(sideLayer);

                IPadSpecificsD padCMPSide = (IPadSpecificsD)cmpSide.GetSpecificsD();

                if (top)
                {
                    padCMPSide.Location = new PointD(offset + height / 2, component.Bounds.Y + component.Bounds.Height / 2);
                }
                else
                {
                    padCMPSide.Location = new PointD(-(offset + height / 2), component.Bounds.Y + component.Bounds.Height / 2);
                }

                cmpSide.SetSpecifics(padCMPSide, componentSide);
                cmpSide.FreeText = component.Ref;
                if (top)
                {
                    cmpSide.ObjectColorTemporary(Color.Silver);
                }
                else
                {
                    cmpSide.ObjectColorTemporary(Color.Gray);
                }
                #endregion
            }
        }