public ElectrodeMoveBuilder(List <Body> headBodys, ElectrodeDatumInfo datum, ElectrodeGapValueInfo gapValue, ElectrodePitchInfo pitch)
 {
     this.headBodys = headBodys;
     this.datum     = datum;
     this.gapValue  = gapValue;
     this.pitch     = pitch;
 }
Esempio n. 2
0
        private void SetEleInfo(ISheet sheet, ICellStyle style)
        {
            ElectrodeGapValueInfo gap = this.info.GetGapValueInfo();

            if (gap.CrudeInter != 0)
            {
                ExcelUtils.SetValue(sheet, style, 3, 12, gap.CrudeInter);
            }
            if (gap.DuringInter != 0)
            {
                ExcelUtils.SetValue(sheet, style, 3, 14, gap.DuringInter);
            }
            if (gap.FineInter != 0)
            {
                ExcelUtils.SetValue(sheet, style, 3, 16, gap.FineInter);
            }
            if (this.info.AskEleIsOffset())
            {
                ExcelUtils.SetValue(sheet, style, 4, 16, "已扣");
            }
            else
            {
                ExcelUtils.SetValue(sheet, style, 4, 16, "未扣");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 给齿上颜色
        /// </summary>
        private void SetHeadColour(ElectrodePitchInfo pitch, ElectrodeGapValueInfo gapValue, List <Body> bodys)
        {
            Matrix4 matr = new Matrix4();

            matr.Identity();
            Matrix4 inv = matr.GetInversMatrix();
            CartesianCoordinateSystem csys = BoundingBoxUtils.CreateCoordinateSystem(matr, inv);
            var toolhList = bodys.GroupBy(a => AttributeUtils.GetAttrForString(a, "ToolhName"));
            List <ElectrodeToolhInfo[, ]> toolhInfos = new List <ElectrodeToolhInfo[, ]>();

            try
            {
                foreach (var toolh in toolhList)
                {
                    ElectrodeToolhInfo[,] toolhInfo = pitch.GetToolhInfosForAttribute(toolh.ToList(), matr, csys);
                    toolhInfos.Add(toolhInfo);
                }
                if (toolhInfos.Count != 0)
                {
                    gapValue.SetERToolh(toolhInfos);
                }
            }
            catch (Exception ex)
            {
                ClassItem.WriteLogFile("设置颜色错误!" + ex.Message);
            }
        }
Esempio n. 4
0
        public ManyInterElectrodeCAM(ElectrodeModel model, UserModel user) : base(model.PartTag, user)
        {
            this.IsCompute = true;
            this.model     = model;
            ElectrodeGapValueInfo gap = model.Info.AllInfo.GapValue;

            if (gap.FineInter != 0)
            {
                tempInter = gap.FineInter;
                interName = "F";
                return;
            }

            if (gap.DuringInter != 0)
            {
                tempInter = gap.DuringInter;
                interName = "D";
                return;
            }
            if (gap.CrudeInter != 0)
            {
                tempInter = gap.CrudeInter;
                interName = "R";
                return;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 获取电极间隙
        /// </summary>
        /// <returns></returns>
        private ElectrodeGapValueInfo GetEleGapValue()
        {
            ElectrodeGapValueInfo gapValue = new ElectrodeGapValueInfo();

            if (checkBox_crude.Checked)
            {
                string cru = this.comboBox_crudeInter.Text;
                string num = this.comboBox_crudeNum.Text;
                if (cru != "")
                {
                    gapValue.CrudeInter = double.Parse(cru);
                }
                if (num != "")
                {
                    gapValue.CrudeNum = int.Parse(num);
                }
            }
            if (checkBox_during.Checked)
            {
                string cru = this.comboBox_duringInter.Text;
                string num = this.comboBox_duringNum.Text;
                if (cru != "")
                {
                    gapValue.DuringInter = double.Parse(cru);
                }
                if (num != "")
                {
                    gapValue.DuringNum = int.Parse(num);
                }
            }
            if (checkBox_fine.Checked)
            {
                string cru = this.comboBox_fineInter.Text;
                string num = this.comboBox_fineNum.Text;
                if (cru != "")
                {
                    gapValue.FineInter = double.Parse(cru);
                }
                if (num != "")
                {
                    gapValue.FineNum = int.Parse(num);
                }
            }
            gapValue.ERNum = er;
            return(gapValue);
        }
Esempio n. 6
0
 /// <summary>
 /// 获取间隙
 /// </summary>
 /// <returns></returns>
 public ElectrodeGapValueInfo GetGapValueInfo()
 {
     if (ParentAssmblieInfo.IsElectrode(this.pt))
     {
         return(ElectrodeGapValueInfo.GetAttribute(this.pt));
     }
     else
     {
         return(new ElectrodeGapValueInfo()
         {
             CrudeInter = 0,
             CrudeNum = 0,
             DuringInter = 0,
             DuringNum = 0,
             FineInter = 0,
             FineNum = 0
         });
     }
 }
        public override bool CreateOffsetInter()
        {
            if (allFace.Count == 0)
            {
                allFace = analysis.GetAllFaces();
            }
            List <Face> erFaces = new List <Face>();
            List <Face> efFaces = new List <Face>();

            GetEFanERFace(allFace, out erFaces, out efFaces);
            ElectrodeGapValueInfo gap = this.model.Info.AllInfo.GapValue;

            this.IsOffsetInter = offser.SetOffsetInter(erFaces, gap.CrudeInter, efFaces, gap.FineInter);
            if (!this.IsOffsetInter)
            {
                this.Inter = gap.FineInter;
            }
            else
            {
                this.Inter = 0;
            }
            return(false);
        }
        public static AbstractElectrodeCAM CreateCAM(Part pt, UserModel user)
        {
            AbstractElectrodeCAM cam = null;

            if (ParentAssmblieInfo.IsElectrode(pt))
            {
                ElectrodeModel        em  = new ElectrodeModel(pt);
                ElectrodeGapValueInfo gap = em.Info.AllInfo.GapValue;
                if ((gap.ERNum[0] != 0 || gap.ERNum[1] != 0) && (gap.FineInter != 0 && gap.FineNum != 0) &&
                    (gap.CrudeInter != 0 && gap.CrudeNum == 0))
                {
                    try
                    {
                        cam = new ErAndEfElectrodeCAM(em, user);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                else if (((gap.FineInter != 0 && gap.FineNum != 0) && (gap.CrudeInter != 0 && gap.CrudeNum != 0)) ||
                         ((gap.FineInter != 0 && gap.FineNum != 0) && (gap.DuringInter != 0 && gap.DuringNum != 0)) ||
                         ((gap.CrudeInter != 0 && gap.CrudeNum != 0) && (gap.DuringInter != 0 && gap.DuringNum != 0)))
                {
                    try
                    {
                        cam = new ManyInterElectrodeCAM(em, user);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                else if (((gap.FineInter != 0 && gap.FineNum != 0) && (gap.CrudeInter == 0 && gap.CrudeNum == 0) && (gap.DuringNum == 0 && gap.DuringNum == 0)) ||
                         ((gap.FineInter == 0 && gap.FineNum == 0) && (gap.CrudeInter != 0 && gap.CrudeNum != 0) && (gap.DuringNum == 0 && gap.DuringNum == 0)) ||
                         ((gap.FineInter == 0 && gap.FineNum == 0) && (gap.CrudeInter == 0 && gap.CrudeNum == 0) && (gap.DuringNum != 0 && gap.DuringNum != 0)))
                {
                    try
                    {
                        cam = new OnlyInterElectrodeCAM(em, user);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }

                else
                {
                    try
                    {
                        cam = new NonStandardElectrodeCAM(pt, user);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            else
            {
                try
                {
                    cam = new NonStandardElectrodeCAM(pt, user);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(cam);
        }
        public override Dictionary <double, BoundaryModel[]> GetBaseFaceBoundary()
        {
            Dictionary <double, BoundaryModel[]> dic = new Dictionary <double, BoundaryModel[]>();

            if (this.IsOffsetInter)
            {
                List <BoundaryModel> boundary = new List <BoundaryModel>();
                List <FaceData>      other    = analysis.GetOtherBaseFaces();
                if (other.Count > 0)
                {
                    foreach (FaceData fe in other)
                    {
                        PlanarBoundary pb = new PlanarBoundary(fe);
                        BoundaryModel  model;
                        double         blank;
                        pb.GetPeripheralBoundary(out model, out blank);
                        boundary.Add(model);
                    }
                }
                PlanarBoundary pby = new PlanarBoundary(analysis.BaseFace);
                boundary.AddRange(pby.GetHoleBoundary());
                dic.Add(0, boundary.ToArray());
            }
            else
            {
                List <BoundaryModel> erBoundary = new List <BoundaryModel>();
                List <BoundaryModel> efBoundary = new List <BoundaryModel>();
                List <FaceData>      other      = analysis.GetOtherBaseFaces();
                if (other.Count > 0)
                {
                    List <FaceData> er = new List <FaceData>();
                    List <FaceData> ef = new List <FaceData>();
                    GetEFanERFace(other, out er, out ef);
                    foreach (FaceData fd in er)
                    {
                        PlanarBoundary pb = new PlanarBoundary(fd);
                        BoundaryModel  model;
                        double         blank;
                        pb.GetPeripheralBoundary(out model, out blank);
                        erBoundary.Add(model);
                    }
                    foreach (FaceData fd in ef)
                    {
                        PlanarBoundary pb = new PlanarBoundary(fd);
                        BoundaryModel  model;
                        double         blank;
                        pb.GetPeripheralBoundary(out model, out blank);
                        efBoundary.Add(model);
                    }
                }
                PlanarBoundary       pby      = new PlanarBoundary(analysis.BaseFace);
                List <BoundaryModel> boundary = pby.GetHoleBoundary();
                foreach (BoundaryModel bm in boundary)
                {
                    Edge eg = bm.Curves[0] as Edge;
                    foreach (Face fe in eg.GetFaces())
                    {
                        string er = AttributeUtils.GetAttrForString(fe, "ToolhGapValue");
                        if (er.Equals("ER", StringComparison.CurrentCultureIgnoreCase))
                        {
                            erBoundary.Add(bm);
                            break;
                        }
                        else if (er.Equals("EF", StringComparison.CurrentCultureIgnoreCase))
                        {
                            efBoundary.Add(bm);
                            break;
                        }
                    }
                }
                ElectrodeGapValueInfo gap = this.model.Info.AllInfo.GapValue;
                dic.Add(gap.CrudeInter, erBoundary.ToArray());
                dic.Add(gap.FineInter, efBoundary.ToArray());
            }

            return(dic);
        }