Пример #1
0
        /// <summary>
        /// 获取阻抗 Impedance_Lists
        /// path: 由于获取阻抗是 STACKUP 中取
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetImpedance_Lists2()
        {
            //stackup 获取阻抗
            stackup = theJob.Stackup();
            int totalImpCon;
            int totalImpLin;

            totalImpCon = 0;
            totalImpLin = 0;
            //IImpedanceConstraint
            foreach (IImpedanceConstraint impCon in stackup.ImpedanceConstraints())
            {
                totalImpCon = totalImpCon + 1;
            }
            jobNum_IMP_ITEM = totalImpCon;
            Dictionary <string, string>[] dictImpCon = new Dictionary <string, string> [totalImpCon];
            Dictionary <string, string>[] dictImpLin = new Dictionary <string, string> [totalImpLin];

            for (int dictImpConLength = 0; dictImpConLength < dictImpCon.Length; dictImpConLength++)
            {
                dictImpCon[dictImpConLength] = new Dictionary <string, string>();
            }
            for (int dictImpLinLength = 0; dictImpLinLength < dictImpLin.Length; dictImpLinLength++)
            {
                dictImpLin[dictImpLinLength] = new Dictionary <string, string>();
            }
            int i;

            i = 0;
            try
            {
                foreach (IImpedanceConstraint impCon in stackup.ImpedanceConstraints())
                {
                    Dictionary <string, string> dictAllImpCon = new Dictionary <string, string>();
                    XmlGenerate.AllAttrGetKeyValues(impCon, dictAllImpCon);

                    //阻抗模型 取值  OK
                    //编号取层 OK
                    //字段取值 NOT   NUM_SIGNAL="待确定"

                    int modecode = (int)Enum.Parse(typeof(XmlGenerate.ImdependenceModel), impCon.ModelName(), true);



                    //字段取值
                    //string modelname=impCon.ModelName();
                    //信号层
                    ICopperLayer trace_layer;
                    trace_layer = impCon.ControlledTraceLayer();
                    string tracelayer = trace_layer.Name();
                    if (tracelayer == "COMP")
                    {
                        tracelayer = "1";
                    }
                    else if (tracelayer == "SOLD")
                    {
                        tracelayer = jobName.Substring(2, 2);
                    }

                    //参考层   TopModelLayer  BottomModelLayer
                    ICopperLayer copperLayertop;
                    ICopperLayer copperLayerbot;
                    copperLayertop = impCon.TopModelLayer();
                    copperLayerbot = impCon.BottomModelLayer();
                    string reftop;
                    string refbot;
                    if (impCon.TopModelLayer() is null)
                    {
                        reftop = "0";
                    }
                    else
                    {
                        reftop = copperLayertop.Name();
                    }

                    if (impCon.BottomModelLayer() is null)
                    {
                        refbot = "0";
                    }
                    else
                    {
                        refbot = copperLayerbot.Name();
                    }

                    //7和8这个模型,单独只取BOTTOM_MODEL_LAYER可行  时间:2019年7月22日22:26:26
                    if (modecode == 7 || modecode == 8)
                    {
                        reftop = "0";
                        refbot = copperLayerbot.Name();
                    }


                    if (reftop == "COMP")
                    {
                        reftop = "1";// L去掉
                    }
                    else if (reftop == "SOLD")
                    {
                        reftop = "" + jobName.Substring(2, 2);
                    }

                    if (refbot == "COMP")
                    {
                        refbot = "1";
                    }
                    else if (refbot == "SOLD")
                    {
                        refbot = "" + jobName.Substring(2, 2);
                    }



                    // 字段: 区分单根双根阻抗  NUM_SIGNAL  待确定
                    // 字段:目标阻抗值   ZO_TARGET CalculationRequiredImpedance()

                    //发现一个问题: 客户要求阻抗不在JOB中
                    double omCustomer    = impCon.CustomerRequiredImpedance(AvailableUnits.OHMS);
                    double LWCustomer    = impCon.OriginalTraceWidth(AvailableUnits.MIL);
                    double LSCopCustomer = impCon.CustomerRequiredCoplanarSpacing(AvailableUnits.MIL);
                    double LSDifCustomer = impCon.CustomerRequiredDifferentialSpacing(AvailableUnits.MIL);



                    double omdouble = impCon.CalculationRequiredImpedance(AvailableUnits.OHMS);
                    double omtol    = omdouble * 0.1;
                    string omstring = impCon.CalculationRequiredImpedance(AvailableUnits.OHMS).ToString();
                    // 字段: 目标阻抗值公差  ZO_TOL  (10%)  CalculationRequiredImpedancePlusTol CalculationRequiredImpedanceMinusTol
                    string tolp = impCon.CalculationRequiredImpedancePlusTol(AvailableUnits.OHMS).ToString();
                    string tolm = impCon.CalculationRequiredImpedanceMinusTol(AvailableUnits.OHMS).ToString();

                    //字段: 设计线宽  WIDTH_DESIGN CALCULATION_REQ_TRACE_WIDTH
                    //已更改
                    double width_double = impCon.CalculationReqLineWidth(AvailableUnits.MIL);
                    string width        = impCon.CalculationReqLineWidth(AvailableUnits.MIL).ToString();
                    //设计间距(差分间距) SPACE_DESIGN   DIFF_SPACE_
                    //共面阻抗间距  COPLANAR_SPACE_DESIGN  COPLANARITY_SPACE_
                    bool cop = impCon.IsNullCustomerRequiredCoplanarSpacing();
                    bool sx  = impCon.IsNullCustomerRequiredDifferentialSpacing();
                    //返回值即可  UDAS属性 值
                    //设计间距(差分间距) SPACE_DESIGN   DIFF_SPACE_
                    //共面阻抗间距  COPLANAR_SPACE_DESIGN  COPLANARITY_SPACE_

                    dictImpCon[i].Add("ITEM_INDEX", (i + 1).ToString());
                    dictImpCon[i].Add("IMP_MODEL_NO", modecode.ToString());
                    dictImpCon[i].Add("SIGNAL_LAYER", tracelayer.Replace("L", ""));//删除L
                    dictImpCon[i].Add("REF_LAYER_1", reftop.Replace("L", ""));
                    dictImpCon[i].Add("REF_LAYER_2", refbot.Replace("L", ""));

                    if (LSDifCustomer > 0)
                    {
                        dictImpCon[i].Add("NUM_SIGNAL", "2");
                    }
                    else if (LSDifCustomer == 0)
                    {
                        dictImpCon[i].Add("NUM_SIGNAL", "1");
                    }

                    //dictImpCon[i].Add("NUM_SIGNAL", (width_double > 0 ? "2" : "1"));
                    //dictImpCon[i].Add("NUM_SIGNAL", " "); //待确定 omCustomer
                    dictImpCon[i].Add("ZO_TARGET", omCustomer.ToString());
                    //客户要求阻抗
                    dictImpCon[i].Add("ZO_TOL", (omCustomer * 0.1).ToString());
                    //dictImpCon[i].Add("ZO_TOL", omtol.ToString());
                    dictImpCon[i].Add("WIDTH_DESIGN", LWCustomer.ToString());
                    //LSCopCustomer
                    dictImpCon[i].Add("SPACE_DESIGN", LSDifCustomer.ToString());
                    //dictImpCon[i].Add("SPACE_DESIGN", dictAllImpCon["DIFF_SPACE_"]);
                    dictImpCon[i].Add("COPLANAR_SPACE_DESIGN", LSCopCustomer.ToString());
                    //dictImpCon[i].Add("COPLANAR_SPACE_DESIGN", dictAllImpCon["COPLANARITY_SPACE_"]);

                    i++;
                }
                listIMP_ITEMT = new List <Dictionary <string, string> >();
                foreach (var item in dictImpCon)
                {
                    listIMP_ITEMT.Add(item);
                }
            }
            catch (Exception ex)
            {
                string str = ex.ToString();
                //throw;
            }
        }
Пример #2
0
        /// <summary>
        /// 获取Materials
        /// 已获取,保存数据即可
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetMaterial()
        {
            //根据MRP_NAME 属性 去掉重复的 Material  FOIL CORE PREPREG
            Dictionary <string, string> dictFoilMrpName    = new Dictionary <string, string>();
            Dictionary <string, string> dictPrepregMrpName = new Dictionary <string, string>();
            Dictionary <string, string> dictCoreMrpName    = new Dictionary <string, string>();

            //根据MRP_NAME 属性 去掉重复的 Material  FOIL CORE PREPREG
            Dictionary <string, string> dictFoilMrpName_N    = new Dictionary <string, string>();
            Dictionary <string, string> dictPrepregMrpName_N = new Dictionary <string, string>();
            Dictionary <string, string> dictCoreMrpName_N    = new Dictionary <string, string>();

            int Total_Core    = 0;
            int Total_Foil    = 0;
            int Total_Prepreg = 0;

            stackup = theJob.Stackup();//job->stackup

            //1、获取数组的长度  {CORE}[X]  [FOIL][X] <PREPREG>[X]
            foreach (IStackupSegment seg in stackup.BuildUpSegments()) //stackup->stksegements->stksegement
            {
                //***************生成stakupsegment
                seg.SegmentIndex();
                seg.SegmentType();
                //seg.JobMaterials();    //stackupsegement
                foreach (IJobMaterial jobmat in seg.JobMaterials()) //stksegement->jobmaterials
                {
                    IMaterial mat = jobmat.Material();              //jobmaterials->jobmaterial

                    //***************生成stakupsegment
                    mat.MrpName();
                    if (mat.MtrType() == MtrType.CORE_MTR)//material->分类  material(CORE)
                    {
                        if (!dictCoreMrpName.Keys.Contains(mat.MrpName()))
                        {
                            dictCoreMrpName.Add(mat.MrpName(), "第" + (Total_Core + 1).ToString() + "种类别的" + mat.MtrType() + ":  " + mat.MrpName());
                            Total_Core++;
                        }
                    }
                    if (mat.MtrType() == MtrType.FOIL_MTR)//material->分类  material(CORE)
                    {
                        if (!dictFoilMrpName.Keys.Contains(mat.MrpName()))
                        {
                            dictFoilMrpName.Add(mat.MrpName(), "第" + (Total_Foil + 1).ToString() + "种类别的" + mat.MtrType() + ":  " + mat.MrpName());
                            Total_Foil++;
                        }
                    }
                    if (mat.MtrType() == MtrType.PREPREG_MTR)//material->分类  material(CORE)
                    {
                        if (!dictPrepregMrpName.Keys.Contains(mat.MrpName()))
                        {
                            dictPrepregMrpName.Add(mat.MrpName(), "第" + (Total_Prepreg + 1).ToString() + "种类别的" + mat.MtrType() + ":  " + mat.MrpName());
                            Total_Prepreg++;
                        }
                    }
                }
            }

            //2 给键值对数组建立固定数组赋初值
            Dictionary <string, dynamic> udaObj = new Dictionary <string, dynamic>();

            Dictionary <string, string>[] dictFoil    = new Dictionary <string, string> [Total_Foil];
            Dictionary <string, string>[] dictCore    = new Dictionary <string, string> [Total_Core];
            Dictionary <string, string>[] dictPrepreg = new Dictionary <string, string> [Total_Prepreg];

            for (int arrayLenth = 0; arrayLenth < dictFoil.Length; arrayLenth++)
            {
                dictFoil[arrayLenth] = new Dictionary <string, string>();
            }
            for (int arrayLenth = 0; arrayLenth < dictCore.Length; arrayLenth++)
            {
                dictCore[arrayLenth] = new Dictionary <string, string>();
            }
            for (int arrayLenth = 0; arrayLenth < dictPrepreg.Length; arrayLenth++)
            {
                dictPrepreg[arrayLenth] = new Dictionary <string, string>();
            }

            //给键值对数组  添加指定属性的元素
            //数组下标

            int i, j, k;

            i = 0;
            j = 0;
            k = 0;



            try
            {
                foreach (IStackupSegment seg in stackup.BuildUpSegments()) //stackup->stksegements->stksegement
                {
                    foreach (IJobMaterial jobmat in seg.JobMaterials())    //stksegement->jobmaterials
                    {
                        IMaterial mat = jobmat.Material();                 //jobmaterials->jobmaterial
                        //base_Material = mat.Family();
                        if (mat.MtrType() == MtrType.FOIL_MTR)             //material->分类  material(CORE)
                        {
                            //针对CORE属性  1、CORE所有属性  2、属性筛选 3、添加键值对
                            IFoil foil = mat.Foil();
                            Dictionary <string, string> dictAllFoil = new Dictionary <string, string>();
                            XmlGenerate.AllAttrGetKeyValues(foil, dictAllFoil);
                            XmlGenerate.AllAttrGetKeyValues(mat, dictAllFoil);
                            //Base_Material = dictAllFoil["FAMILY"];
                            string[] a      = attrsMaterialsFoil;
                            string[] b      = attrsMaterialsFoil_Inplan;
                            int      length = 0;
                            if (a.Length == b.Length)
                            {
                                length = a.Length;
                            }
                            else
                            {
                                string str = "请检查是否数组长度定义一一对应";
                            }

                            if (!dictFoilMrpName_N.Keys.Contains(dictAllFoil["MRP_NAME"]))
                            {
                                dictFoilMrpName_N.Add(dictAllFoil["MRP_NAME"], "第" + (i + 1).ToString() + "种类别的" + mat.MtrType() + ":  " + dictAllFoil["MRP_NAME"]);
                                for (int l = 0; l < length; l++)
                                {
                                    dictFoil[i].Add(a[l], dictAllFoil[b[l]]);
                                }
                                i++;
                            }
                            string debug = "";
                        }
                        if (mat.MtrType() == MtrType.PREPREG_MTR)//material->分类  material(CORE)
                        {
                            IPrepreg prepreg = mat.Prepreg();
                            Dictionary <string, string> dictAllPrepreg = new Dictionary <string, string>();
                            XmlGenerate.AllAttrGetKeyValues(prepreg, dictAllPrepreg);
                            XmlGenerate.AllAttrGetKeyValues(mat, dictAllPrepreg);
                            base_Material = dictAllPrepreg["FAMILY"];
                            string[] a      = attrsMaterialsPrepreg;
                            string[] b      = attrsMaterialsPrepreg_Inplan;
                            int      length = 0;
                            if (a.Length == b.Length)
                            {
                                length = a.Length;
                            }
                            else
                            {
                                string str = "请检查是否数组长度定义一一对应";
                            }
                            if (!dictPrepregMrpName_N.Keys.Contains(dictAllPrepreg["MRP_NAME"]))
                            {
                                dictPrepregMrpName_N.Add(dictAllPrepreg["MRP_NAME"], "第" + (j + 1).ToString() + "种类别的" + mat.MtrType() + ":  " + dictAllPrepreg["MRP_NAME"]);
                                for (int l = 0; l < length; l++)
                                {
                                    dictPrepreg[j].Add(a[l], dictAllPrepreg[b[l]]);
                                }
                                j++;
                            }
                            string debug = "";
                        }
                        if (mat.MtrType() == MtrType.CORE_MTR)//material->分类  material(CORE)
                        {
                            ICore core = mat.Core();
                            Dictionary <string, string> dictAllCore = new Dictionary <string, string>();
                            XmlGenerate.AllAttrGetKeyValues(core, dictAllCore);
                            XmlGenerate.AllAttrGetKeyValues(mat, dictAllCore);
                            base_Material = dictAllCore["FAMILY"];
                            string[] a      = attrsMaterialsCore;
                            string[] b      = attrsMaterialsCore_Inplan;
                            int      length = 0;
                            if (a.Length == b.Length)
                            {
                                length = a.Length;
                            }
                            else
                            {
                                string str = "请检查是否数组长度定义一一对应";
                            }
                            if (!dictCoreMrpName_N.Keys.Contains(dictAllCore["MRP_NAME"]))
                            {
                                dictCoreMrpName_N.Add(dictAllCore["MRP_NAME"], "第" + (k + 1).ToString() + "种类别的" + mat.MtrType() + ":  " + dictAllCore["MRP_NAME"]);
                                for (int l = 0; l < length; l++)
                                {
                                    dictCore[k].Add(a[l], dictAllCore[b[l]]);
                                }
                                k++;
                            }
                            string debug = "";
                        }
                    }
                }

                //对应XML子节点个数
                jobNum_FOIL        = Total_Foil;
                jobNum_PREPREG     = Total_Prepreg;
                jobNum_CORE        = Total_Core;
                jobNum_STACKUP_SEG = Total_Foil + Total_Prepreg + Total_Core;

                listFoilT    = new List <Dictionary <string, string> >();
                listPrepregT = new List <Dictionary <string, string> >();
                listCoreT    = new List <Dictionary <string, string> >();
                foreach (var item in dictFoil)
                {
                    listFoilT.Add(item);
                }
                foreach (var item in dictPrepreg)
                {
                    listPrepregT.Add(item);
                }
                foreach (var item in dictCore)
                {
                    listCoreT.Add(item);
                }
                dictFoilT    = dictFoil;
                dictPrepregT = dictPrepreg;
                dictCoreT    = dictCore;
            }
            catch (Exception ex)
            {
                string exmess = ex.ToString();
                //throw;
            }
        }