private Anel GerarAnel(Decimal[] elem_info, Decimal[] ordinates, int dimensoes, int eixoLrs, ref int triplet)
        {
            Anel anel = (Anel)null;
            bool flag = eixoLrs != 0;

            if (elem_info[triplet + 1] == new Decimal(1005) || elem_info[triplet + 1] == new Decimal(2005))
            {
                try
                {
                    int int32_1 = Convert.ToInt32(elem_info[triplet + 2]);
                    anel = new Anel();
                    for (int index = 0; index < int32_1; ++index)
                    {
                        triplet += 3;
                        if (elem_info[triplet + 1] != new Decimal(2))
                        {
                            throw new Exception("Tipo heterogêneo de anel errado");
                        }
                        int           int32_2  = Convert.ToInt32(elem_info[triplet]);
                        int           fim      = triplet < elem_info.Length - 3 ? Convert.ToInt32(elem_info[triplet + 3]) - (index == int32_1 - 1 ? 1 : -1) : ordinates.Length - 1;
                        SegmentoLinha segmento = this.GerarSegmento(ordinates, int32_2, fim, Convert.ToInt32(elem_info[triplet + 2]), dimensoes, eixoLrs);
                        if (segmento == null)
                        {
                            throw new Exception("Falha ao ler um segmento");
                        }
                        anel.Segmentos.Adicionar(segmento);
                    }
                }
                catch
                {
                    anel = (Anel)null;
                }
            }
            else if (elem_info[triplet + 1] == new Decimal(1003) || elem_info[triplet + 1] == new Decimal(2003))
            {
                try
                {
                    int           int32    = Convert.ToInt32(elem_info[triplet]);
                    int           fim      = triplet < elem_info.Length - 3 ? Convert.ToInt32((elem_info[triplet + 3]) - 1) : ordinates.Length - 1;
                    SegmentoLinha segmento = this.GerarSegmento(ordinates, int32, fim, Convert.ToInt32(elem_info[triplet + 2]), dimensoes, eixoLrs);
                    if (segmento == null)
                    {
                        throw new Exception("Falha ao ler um segmento");
                    }
                    if (elem_info[triplet + 2] == new Decimal(3))
                    {
                        Posicao[] posicaoArray = new Posicao[4]
                        {
                            segmento.Posicoes[0],
                            null,
                            segmento.Posicoes[1],
                            null
                        };
                        posicaoArray[1]   = new Posicao(posicaoArray[0].Dimensoes, posicaoArray[0].EhLrs);
                        posicaoArray[1].X = posicaoArray[2].X;
                        posicaoArray[1].Y = posicaoArray[0].Y;
                        if (posicaoArray[1].Dimensoes == 3)
                        {
                            posicaoArray[1].Z = posicaoArray[0].Z;
                        }
                        posicaoArray[3]   = new Posicao(posicaoArray[2].Dimensoes, posicaoArray[2].EhLrs);
                        posicaoArray[3].X = posicaoArray[0].X;
                        posicaoArray[3].Y = posicaoArray[2].Y;
                        if (posicaoArray[3].Dimensoes == 3)
                        {
                            posicaoArray[3].Z = posicaoArray[2].Z;
                        }
                        segmento = (SegmentoLinha) new SegmentoLinhaReto();
                        segmento.Posicoes.Adicionar(posicaoArray[0]);
                        if (elem_info[triplet + 1] == new Decimal(1003))
                        {
                            segmento.Posicoes.Adicionar(posicaoArray[1]);
                            segmento.Posicoes.Adicionar(posicaoArray[2]);
                            segmento.Posicoes.Adicionar(posicaoArray[3]);
                        }
                        else
                        {
                            segmento.Posicoes.Adicionar(posicaoArray[3]);
                            segmento.Posicoes.Adicionar(posicaoArray[2]);
                            segmento.Posicoes.Adicionar(posicaoArray[1]);
                        }
                        segmento.Posicoes.Adicionar(posicaoArray[0]);
                    }
                    anel = new Anel();
                    anel.Segmentos.Adicionar(segmento);
                }
                catch
                {
                }
            }
            return(anel);
        }
        private LinhaCollection GerarLinhas(Decimal[] elem_info, Decimal[] ordinates, int dimensoes, int eixoLrs, bool multiplo)
        {
            LinhaCollection linhaCollection = new LinhaCollection();
            int             index1          = 0;
            bool            ehLrs           = eixoLrs != 0;

            while (index1 < elem_info.Length)
            {
                if (elem_info[index1 + 1] == new Decimal(4))
                {
                    try
                    {
                        int   int32_1 = Convert.ToInt32(elem_info[index1 + 2]);
                        Linha linha   = new Linha(ehLrs ? dimensoes - 1 : dimensoes, ehLrs);
                        for (int index2 = 0; index2 < int32_1; ++index2)
                        {
                            index1 += 3;
                            if (elem_info[index1 + 1] != new Decimal(2))
                            {
                                throw new Exception("Tipo heterogêneo de linha errado");
                            }
                            int           int32_2  = Convert.ToInt32(elem_info[index1]);
                            int           fim      = index1 < elem_info.Length - 3 ? Convert.ToInt32(elem_info[index1 + 3]) - (index2 == int32_1 - 1 ? 1 : -1) : ordinates.Length - 1;
                            SegmentoLinha segmento = this.GerarSegmento(ordinates, int32_2, fim, Convert.ToInt32(elem_info[index1 + 2]), dimensoes, eixoLrs);
                            if (segmento == null)
                            {
                                throw new Exception("Falha ao ler um segmento");
                            }
                            linha.Segmentos.Adicionar(segmento);
                        }
                        linhaCollection.Adicionar(linha);
                    }
                    catch
                    {
                    }
                    if (!multiplo)
                    {
                        return(linhaCollection);
                    }
                }
                else if (elem_info[index1 + 1] == new Decimal(2))
                {
                    try
                    {
                        int           int32    = Convert.ToInt32(elem_info[index1]);
                        int           fim      = index1 < elem_info.Length - 3 ? Convert.ToInt32((elem_info[index1 + 3]) - 1) : ordinates.Length - 1;
                        SegmentoLinha segmento = this.GerarSegmento(ordinates, int32, fim, Convert.ToInt32(elem_info[index1 + 2]), dimensoes, eixoLrs);
                        Linha         linha    = new Linha(ehLrs ? dimensoes - 1 : dimensoes, ehLrs);
                        if (segmento == null)
                        {
                            throw new Exception("Falha ao ler um segmento");
                        }
                        linha.Segmentos.Adicionar(segmento);
                        linhaCollection.Adicionar(linha);
                    }
                    catch
                    {
                    }
                    if (!multiplo)
                    {
                        return(linhaCollection);
                    }
                }
                else if (elem_info[index1 + 1] == new Decimal(1005) || elem_info[index1 + 1] == new Decimal(2005))
                {
                    index1 += 3 * Convert.ToInt32(elem_info[index1 + 2]);
                }
                index1 += 3;
            }
            return(linhaCollection);
        }