Beispiel #1
0
 public void Sort_BendDistance(ref List <clsPart.sBend> Bend_In)
 //=============================================================
 {
     clsPart.sBend pBend = new clsPart.sBend();
     for (int i = 0; i < Bend_In.Count; i++)
     {
         for (int j = 0; j < Bend_In.Count - 1; j++)
         {
             if (Bend_In[j].Distance > Bend_In[j + 1].Distance)
             {
                 pBend          = Bend_In[j];
                 Bend_In[j]     = Bend_In[j + 1];
                 Bend_In[j + 1] = pBend;
             }
         }
     }
 }
Beispiel #2
0
        //======================

        public void ReadDXFFile(string FileName_In)
        //==========================================
        {
            #region "PART:"
            //=============

            List <clsEntity> pEntityList_Temp = new List <clsEntity>();
            pEntityList_Temp = ReadDXFLayer(FileName_In, "PROGP");              //....For the Unfolded part information.
            //pEntityList_Temp = ReadDXFLayer(FileName_In, "OBJ");

            string pFileTitle = "";
            int    a          = FileName_In.LastIndexOf("\\") + 2;

            pFileTitle = FileName_In.Substring(a, FileName_In.Length - a).Remove(FileName_In.Substring(a, FileName_In.Length - a).Length - 4);
            clsPart pPart = new clsPart();
            pPart.PartNo = pFileTitle;
            List <clsEntity> pEntityList = new List <clsEntity>();
            pEntityList           = ArrangeEntityCW(pEntityList_Temp);
            pPart.Entity_Unfolded = pEntityList;
            pPart.DetermineSize();

            pEntityList_Temp = new List <clsEntity>();
            pEntityList_Temp = ReadDXFLayer(FileName_In, "OBJ");                //....For the folded part information.

            pEntityList         = new List <clsEntity>();
            pEntityList         = ArrangeEntityCW(pEntityList_Temp);
            pPart.Entity_folded = pEntityList;

            List <double> pDistance = new List <double>();
            for (int i = 0; i < pPart.Entity_folded.Count; i++)
            {
                pDistance.Add(clsEntity.GetDistance_BetwnPts(pPart.Entity_folded[i].Begin_Pt, pPart.Entity_folded[i].End_Pt));
            }
            pDistance.Sort();
            pPart.Thickness = pDistance[0];

            #endregion


            #region "BEND:"
            //=============

            pEntityList_Temp = new List <clsEntity>();
            List <clsPart.sBend> pBendList = new List <clsPart.sBend>();

            pEntityList_Temp = ReadDXFLayer(FileName_In, "BENDU");
            if (pEntityList_Temp.Count > 0)
            {
                for (int j = 0; j < pEntityList_Temp.Count; j++)
                {
                    clsPart.sBend pBend = new clsPart.sBend();
                    pBend.Distance = pPart.XMax() - pEntityList_Temp[j].Begin_Pt.X;
                    pBend.Dir      = clsPart.eBendDir.U;
                    pBendList.Add(pBend);
                }
            }

            pEntityList_Temp = new List <clsEntity>();
            pEntityList_Temp = ReadDXFLayer(FileName_In, "BENDD");
            if (pEntityList_Temp.Count > 0)
            {
                for (int j = 0; j < pEntityList_Temp.Count; j++)
                {
                    clsPart.sBend pBend = new clsPart.sBend();
                    pBend.Distance = pPart.XMax() - pEntityList_Temp[j].Begin_Pt.X;
                    pBend.Dir      = clsPart.eBendDir.D;
                    pBendList.Add(pBend);
                }
            }

            pPart.Sort_BendDistance(ref pBendList);
            pPart.BendList_Left = pBendList;
            List <Single> pAngle = pPart.DetermineBendAngle();
            for (int i = 0; i < pPart.BendList_Left.Count; i++)
            {
                if (pPart.BendList_Left[i].Dir == clsPart.eBendDir.D)
                {
                    clsPart.sBend pBend = new clsPart.sBend();
                    pBend.Distance         = pPart.BendList_Left[i].Distance;
                    pBend.Angle            = pAngle[i];
                    pBend.Dir              = pPart.BendList_Left[i].Dir;
                    pPart.BendList_Left[i] = pBend;
                }
                else
                {
                    clsPart.sBend pBend = new clsPart.sBend();
                    pBend.Distance         = pPart.BendList_Left[i].Distance;
                    pBend.Angle            = 360 - pAngle[i];
                    pBend.Dir              = pPart.BendList_Left[i].Dir;
                    pPart.BendList_Left[i] = pBend;
                }
            }

            #endregion

            modMain.gEHRTBender.Part.Add(pPart);
        }
Beispiel #3
0
 //=============================================================
 public void Sort_BendDistance(ref List<clsPart.sBend> Bend_In)
 {
     clsPart.sBend pBend = new clsPart.sBend();
         for (int i = 0; i < Bend_In.Count; i++)
         {
             for (int j = 0; j < Bend_In.Count - 1; j++)
             {
                 if (Bend_In[j].Distance > Bend_In[j + 1].Distance)
                 {
                     pBend = Bend_In[j];
                     Bend_In[j] = Bend_In[j + 1];
                     Bend_In[j + 1] = pBend;
                 }
             }
         }
 }