Beispiel #1
0
 /// <summary>
 /// parses dxf file into list of DwgEntity objects
 /// </summary>
 /// <returns></returns>
 private List <IDwgEntity> Parse(List <string> text)
 {
     try
     {
         var           entities    = new List <IDwgEntity>();
         List <string> fileSection = new List <string>();
         for (int i = 0; i < text.Count; i++)
         {
             string str = text[i].Trim();
             if (str == "POINT")
             {
                 var point = new Vector3();
                 point.ParseDXF(GetFileSection(text, i, 16));
                 entities.Add(point);
             }
             if (str == "LINE")
             {
                 var line = new Line3();
                 line.ParseDxf(GetFileSection(text, i, 22));
                 entities.Add(line);
             }
             if (str == "CIRCLE")
             {
                 var circ = new Arc();
                 circ.ParseCircleDxf(GetFileSection(text, i, 18));
                 entities.Add(circ);
             }
             if (str == "ARC")
             {
                 var arc = new Arc();
                 arc.ParseArcDxf(GetFileSection(text, i, 24));
                 entities.Add(arc);
             }
         }
         return(entities);
     }
     catch (Exception)
     {
         throw;
     }
 }