示例#1
0
        private static void SetValue(DynamicBlockReferenceProperty dynProp, object value)
        {
            // https://adn-cis.org/forum/index.php?topic=9816.msg43581#msg43581
            object valueObj;

            switch (dynProp.PropertyTypeCode)
            {
            // kDwgNull
            case 0:
                return;

            // kDwgReal
            case 1:
                valueObj = value.GetValue <double>();
                break;

            default:
                valueObj = Convert.ChangeType(value, dynProp.Value.GetType());
                break;
            }

            if (!Equals(valueObj, dynProp.Value))
            {
                dynProp.Value = valueObj;
            }
        }
示例#2
0
        private void SetDynamicValue(DynamicBlockReferenceProperty dbrProp, JsonBlockProperty block)
        {
            //System.Diagnostics.Debug.WriteLine($"AutoCAD TAG: {attRef.Tag}");
            var properties = block.Custom.GetType().GetProperties();

            foreach (var prop in properties)
            {
                var customAttributes = prop
                                       .GetCustomAttributes(typeof(Newtonsoft.Json.JsonPropertyAttribute), false);
                if (customAttributes.Length == 1)
                {
                    var jsonProp    = customAttributes[0];
                    var jsonTagName = (jsonProp as Newtonsoft.Json.JsonPropertyAttribute).PropertyName;
                    //System.Diagnostics.Debug.WriteLine($"\tJSONProperty Name: {jsonTagName}");
                    if (dbrProp.PropertyName == jsonTagName)
                    {
                        //var propValue = prop.GetValue(block.Custom);
                        //if (propValue == null) continue;

                        //dbrProp.Value = Convert.ToInt16(propValue);
                        //break;


                        prop.SetValue(block.Custom, dbrProp.Value); //serialization
                        break;
                    }
                }
            }
        }
示例#3
0
 public static void SetDynamicParameterValue(this BlockReference block, string parameterName, object parameterValue)
 {
     if (block.IsDynamicBlock)
     {
         DynamicBlockReferencePropertyCollection pc   = block.DynamicBlockReferencePropertyCollection;
         DynamicBlockReferenceProperty           prop = pc
                                                        .Cast <DynamicBlockReferenceProperty>()
                                                        .FirstOrDefault(p => p.PropertyName.Equals(parameterName, StringComparison.InvariantCulture));
         if (prop != null)
         {
             if (prop.PropertyTypeCode == (short)DynamicPropertyTypes.Distance)
             {
                 prop.Value = parameterValue;
             }
             else if (prop.PropertyTypeCode == (short)DynamicPropertyTypes.Visibility)
             {
                 object val = prop.GetAllowedValues()
                              .First(n => n.ToString() == parameterValue.ToString());
                 prop.Value = val;
             }
         }
         else
         {
             throw new ArgumentException("No parameter " + parameterName);
         }
     }
 }
示例#4
0
 private void SetBlockSheetSize(BlockReference blkRef, string sheetSize, Transaction tr)
 {
     try
     {
         //TODO: Return other cases here as well
         if (!_sheetSizes.Contains(sheetSize))
         {
             return;
         }
         switch (blkRef.GetBlockName(tr))
         {
         case "ENGINEERING - DYNAMIC TITLE BLOCK":
             DynamicBlockReferenceProperty p =
                 (from DynamicBlockReferenceProperty d in blkRef.DynamicBlockReferencePropertyCollection
                  where d.PropertyName == "Visibility1"
                  select d).First();
             p.Value = sheetSize;
             break;
         }
     }
     catch (Exception ex)
     {
         _ed.WriteMessage("Unexpected error in SetBlockSheetSize()" + "\n" + ex.Message + "\n");
     }
 }
示例#5
0
 public Property([NotNull] DynamicBlockReferenceProperty dynProp)
 {
     Name       = dynProp.PropertyName;
     Value      = dynProp.Value;
     Type       = PropertyType.Dynamic;
     IsShow     = dynProp.Show;
     IsReadOnly = dynProp.ReadOnly;
 }
示例#6
0
        public static void LerTodosOsBlocosEBuscarOsAtributos()
        {
            Document documentoAtivo = Application.DocumentManager.MdiActiveDocument;
            Database database       = documentoAtivo.Database;

            using (Transaction acTrans = database.TransactionManager.StartTransaction())
            {
                BlockTable blockTable;
                blockTable = acTrans.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable;

                try
                {
                    _lista = new List <AtributosDoBloco>();

                    foreach (string nome in ConstantesTubulacao.TubulacaoNomeDosBlocos)
                    {
                        BlockTableRecord blockTableRecord;
                        blockTableRecord = acTrans.GetObject(blockTable[nome], OpenMode.ForRead) as BlockTableRecord;

                        foreach (ObjectId objId_loopVariable in blockTableRecord)
                        {
                            BlockReference blocoDinamico;
                            blocoDinamico = (BlockReference)acTrans.GetObject(objId_loopVariable, OpenMode.ForRead) as BlockReference;

                            DynamicBlockReferencePropertyCollection properties = blocoDinamico.DynamicBlockReferencePropertyCollection;

                            AtributosDoBloco Atributo1 = new AtributosDoBloco();

                            for (int i = 0; i < properties.Count; i++)
                            {
                                DynamicBlockReferenceProperty property = properties[i];

                                if (property.PropertyName == "Distance1")
                                {
                                    Atributo1.Distancia = property.Value.ToString();
                                }
                            }
                            Atributo1.X         = blocoDinamico.Position.X;
                            Atributo1.Y         = blocoDinamico.Position.Y;
                            Atributo1.nomeBloco = blocoDinamico.Name;
                            Atributo1.Handle    = blocoDinamico.Handle.ToString();
                            Atributo1.Angulo    = blocoDinamico.Rotation;

                            _lista.Add(Atributo1);
                        }
                        continue;
                    }
                }
                catch (Exception e)
                {
                    FinalizaTarefasAposExcecao("Ocorreu um erro ao ler os blocos do AutoCAD.", e);
                }
                acTrans.Commit();
            }
        }
示例#7
0
        public IBlockParameter ReadDynamicParameter(IBlockParameter template, string name)
        {
            if (this.bref == null)
            {
                return(null);
            }
            if (_pc == null)
            {
                Initialize(bref.DynamicBlockReferencePropertyCollection);
            }

            DynamicBlockReferenceProperty prop = _pc.Cast <DynamicBlockReferenceProperty>()
                                                 .FirstOrDefault(p => p.PropertyName.Equals(name, StringComparison.OrdinalIgnoreCase));

            if (prop == null)
            {
                return(null);
            }
            IBlockParameter result = template.Create(prop.PropertyName, prop.Value.ToString());

            return(result);
        }
示例#8
0
        public BlockReference CopyDynamicBlock(BlockTableRecord spaceRecord, ref BlockReference bref, BlockTableRecord br, Transaction tr)
        {
            BlockReference newbref = new BlockReference(Point3d.Origin, br.ObjectId);

            newbref.TransformBy(bref.BlockTransform);
            newbref.BlockUnit = bref.BlockUnit;
            newbref.Normal    = bref.Normal;
            newbref.Layer     = frameBlockAboveLayer;

            spaceRecord.UpgradeOpen();
            spaceRecord.AppendEntity(newbref);
            //tr.AddNewlyCreatedDBObject(newbref, true);
            spaceRecord.DowngradeOpen();

            //newbref.Visible = false;
            //if (bref.IsDynamicBlock)
            //{
            //    BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bref.BlockTableRecord, OpenMode.ForRead);
            //    foreach (ObjectId id in btr)
            //    {
            //        DBObject temp = tr.GetObject(id, OpenMode.ForRead);
            //        if (temp is AttributeDefinition)
            //        {
            //            AttributeDefinition newAttDef = (AttributeDefinition)temp;
            //            AttributeReference attref = new AttributeReference();
            //            attref.SetAttributeFromBlock((AttributeDefinition)temp, bref.BlockTransform);
            //            newbref.AttributeCollection.AppendAttribute(attref);
            //            tr.AddNewlyCreatedDBObject(attref, true);
            //        }
            //    }
            //
            //}

            DynamicBlockReferenceProperty[] array = new DynamicBlockReferenceProperty[100];
            bref.DynamicBlockReferencePropertyCollection.CopyTo(array, 0);

            dynaProps.Add(newbref.ObjectId, array);

            //int i = 0;
            //while(array[i] != null)
            //{
            //    if (!array[i].ReadOnly)
            //    {
            //        newbref.DynamicBlockReferencePropertyCollection[i].Value = array[i].Value;
            //    }
            //    i++;
            //}

            //for (int i = 0; i < bref.DynamicBlockReferencePropertyCollection.Count; i++)
            //{
            //
            //    if (!newbref.DynamicBlockReferencePropertyCollection[i].ReadOnly &&
            //        !bref.DynamicBlockReferencePropertyCollection[i].ReadOnly &&
            //        newbref.DynamicBlockReferencePropertyCollection[i].PropertyName == bref.DynamicBlockReferencePropertyCollection[i].PropertyName
            //        )
            //    {
            //        newbref.DynamicBlockReferencePropertyCollection[i].Value = bref.DynamicBlockReferencePropertyCollection[i];
            //    }
            //}
            return(newbref);
        }
示例#9
0
        public static void LerTodosOsBlocosEBuscarOsAtributos()
        {
            Document documentoAtivo = Application.DocumentManager.MdiActiveDocument;
            Database database       = documentoAtivo.Database;
            Editor   editor         = documentoAtivo.Editor;

            PromptSelectionResult pmtSelRes = editor.GetSelection();

            using (Transaction acTrans = documentoAtivo.TransactionManager.StartTransaction())
            {
                BlockTable blockTable;
                blockTable = acTrans.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable;

                if (pmtSelRes.Status == PromptStatus.OK)
                {
                    _lista         = new List <AtributosDoBloco>();
                    _listaElevacao = new List <TextoElevacao>();

                    foreach (ObjectId id in pmtSelRes.Value.GetObjectIds())
                    {
                        try
                        {
                            AtributosDoBloco Atributo1 = new AtributosDoBloco();

                            foreach (string nome in ConstantesTubulacao.TubulacaoNomeDosBlocos)
                            {
                                BlockTableRecord blockTableRecord;
                                blockTableRecord = acTrans.GetObject(blockTable[nome], OpenMode.ForRead) as BlockTableRecord;

                                if (!blockTableRecord.IsDynamicBlock)
                                {
                                    return;
                                }

                                try
                                {
                                    BlockReference bloco = null;
                                    bloco = acTrans.GetObject(id, OpenMode.ForRead) as BlockReference;
                                    BlockTableRecord nomeRealBloco = null;
                                    nomeRealBloco = acTrans.GetObject(bloco.DynamicBlockTableRecord, OpenMode.ForRead) as BlockTableRecord;

                                    DynamicBlockReferencePropertyCollection properties = bloco.DynamicBlockReferencePropertyCollection;

                                    if (blockTableRecord.IsDynamicBlock && blockTableRecord.Name == nome)
                                    {
                                        for (int i = 0; i < properties.Count; i++)
                                        {
                                            DynamicBlockReferenceProperty property = properties[i];
                                            if (property.PropertyName == "Distance1")
                                            {
                                                Atributo1.Distancia = property.Value.ToString();
                                            }
                                            Atributo1.X         = bloco.Position.X;
                                            Atributo1.Y         = bloco.Position.Y;
                                            Atributo1.NomeBloco = nomeRealBloco.Name;
                                            Atributo1.Handle    = bloco.Handle.ToString();
                                            Atributo1.Angulo    = bloco.Rotation;

                                            var lista = Atributo1.NomeBloco.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                                            if (lista.Where(c => c.Contains("TUBO FF DN ")).Any())
                                            {
                                                string diametro = lista.Where(p => p.Contains("TUBO FF DN ")).Any() ? lista.Where(p => p.Contains("TUBO FF DN ")).FirstOrDefault() : string.Empty;
                                                diametro           = diametro.Replace("TUBO FF DN ", "");
                                                Atributo1.Diametro = diametro;
                                            }
                                            else if (lista.Where(c => c.Contains("TUBO CONC ARMADO DN")).Any())
                                            {
                                                string diametro = lista.Where(p => p.Contains("TUBO CONC ARMADO DN")).Any() ? lista.Where(p => p.Contains("TUBO CONC ARMADO DN")).FirstOrDefault() : string.Empty;
                                                diametro           = diametro.Replace("TUBO CONC ARMADO DN", "");
                                                Atributo1.Diametro = diametro;
                                            }
                                            else if (lista.Where(c => c.Contains("TUBO PVC DN")).Any())
                                            {
                                                string diametro = lista.Where(p => p.Contains("TUBO PVC DN ")).Any() ? lista.Where(p => p.Contains("TUBO PVC DN ")).FirstOrDefault() : string.Empty;
                                                diametro           = diametro.Replace("TUBO PVC DN ", "");
                                                Atributo1.Diametro = diametro;
                                            }

                                            double distancia = Convert.ToDouble(Atributo1.Distancia);

                                            double dimensaoFinalX;
                                            double dimensaoFinalY;

                                            if (bloco.Rotation < 1.5708)
                                            {
                                                dimensaoFinalX = distancia * Math.Cos(bloco.Rotation);
                                                dimensaoFinalY = distancia * Math.Sin(bloco.Rotation);

                                                Atributo1.XTubo = bloco.Position.X + dimensaoFinalX;
                                                Atributo1.YTubo = bloco.Position.Y + dimensaoFinalY;
                                            }
                                            else if (bloco.Rotation > 1.5708 && bloco.Rotation <= 3.14159265)
                                            {
                                                dimensaoFinalX = distancia * Math.Sin(3.14159265 - bloco.Rotation);
                                                dimensaoFinalY = distancia * Math.Cos(3.14159265 - bloco.Rotation);

                                                Atributo1.XTubo = bloco.Position.X - dimensaoFinalX;
                                                Atributo1.YTubo = bloco.Position.Y + dimensaoFinalY;
                                            }
                                            else if (bloco.Rotation > 3.14159265 && bloco.Rotation <= 4.71239)
                                            {
                                                dimensaoFinalX = distancia * Math.Sin(4.71239 - bloco.Rotation);
                                                dimensaoFinalY = distancia * Math.Cos(4.71239 - bloco.Rotation);

                                                Atributo1.XTubo = bloco.Position.X - dimensaoFinalX;
                                                Atributo1.YTubo = bloco.Position.Y - dimensaoFinalY;
                                            }
                                            else if (bloco.Rotation > 4.71239 && bloco.Rotation <= 6.28319)
                                            {
                                                dimensaoFinalX = distancia * Math.Sin(6.28319 - bloco.Rotation);
                                                dimensaoFinalY = distancia * Math.Cos(6.28319 - bloco.Rotation);

                                                Atributo1.XTubo = bloco.Position.X + dimensaoFinalX;
                                                Atributo1.YTubo = bloco.Position.Y - dimensaoFinalY;
                                            }

                                            TextoElevacao Elevacao1 = new TextoElevacao();
                                            //----------------------------------------------------------------------------
                                            Point3dCollection pntCol = new Point3dCollection
                                            {
                                                new Point3d(Atributo1.X - 5, Atributo1.Y + 5, 0),
                                                new Point3d(Atributo1.X + 5, Atributo1.Y + 5, 0),
                                                new Point3d(Atributo1.X + 5, Atributo1.Y - 5, 0),
                                                new Point3d(Atributo1.X - 5, Atributo1.Y - 5, 0)
                                            };

                                            PromptSelectionResult pmtSelResPoint = editor.SelectCrossingPolygon(pntCol);

                                            if (pmtSelResPoint.Status == PromptStatus.OK)
                                            {
                                                MText  itemSelecionado = null;
                                                double distanciaMinima = Double.MaxValue;

                                                foreach (ObjectId objId in pmtSelResPoint.Value.GetObjectIds())
                                                {
                                                    if (objId.ObjectClass.DxfName == "MTEXT")
                                                    {
                                                        var text = acTrans.GetObject(objId, OpenMode.ForWrite) as MText;
                                                        if (text.Text.Contains("CF="))
                                                        {
                                                            double distanciaTexto = Math.Sqrt(Math.Pow(text.Location.X - Atributo1.X, 2) + Math.Pow(text.Location.Y - Atributo1.Y, 2));
                                                            if (distanciaTexto < distanciaMinima)
                                                            {
                                                                distanciaMinima = distanciaTexto;
                                                                itemSelecionado = text;
                                                            }
                                                        }
                                                    }
                                                }
                                                if (itemSelecionado != null)
                                                {
                                                    var listaTexto = itemSelecionado.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

                                                    string textoCA = listaTexto.Where(d => d.Contains("CF=")).Any() ? listaTexto.Where(p => p.Contains("CF=")).FirstOrDefault() : string.Empty;
                                                    textoCA = textoCA.Replace("CF=", "");

                                                    Elevacao1.ElevacaoInicial = textoCA;
                                                    Elevacao1.PosicaoX        = itemSelecionado.Location.X;
                                                    Elevacao1.PosicaoY        = itemSelecionado.Location.Y;
                                                }
                                                else
                                                {
                                                    editor.WriteMessage("\nAs Elevações não foram encontradas!");
                                                }
                                            }
                                            //----------------------------------------------------------------------------------------------
                                            Point3dCollection pntColElevacao = new Point3dCollection
                                            {
                                                new Point3d(Atributo1.XTubo - 5, Atributo1.YTubo + 5, 0),
                                                new Point3d(Atributo1.XTubo + 5, Atributo1.YTubo + 5, 0),
                                                new Point3d(Atributo1.XTubo + 5, Atributo1.YTubo - 5, 0),
                                                new Point3d(Atributo1.XTubo - 5, Atributo1.YTubo - 5, 0)
                                            };
                                            PromptSelectionResult pmtSelResPoint2 = editor.SelectCrossingPolygon(pntColElevacao);

                                            if (pmtSelResPoint2.Status == PromptStatus.OK)
                                            {
                                                MText  itemSelecionado2 = null;
                                                double distanciaMinima2 = Double.MaxValue;

                                                foreach (ObjectId objId2 in pmtSelResPoint2.Value.GetObjectIds())
                                                {
                                                    if (objId2.ObjectClass.DxfName == "MTEXT")
                                                    {
                                                        var text2 = acTrans.GetObject(objId2, OpenMode.ForWrite) as MText;
                                                        if (text2.Text.Contains("CF="))
                                                        {
                                                            double distanciaTexto2 = Math.Sqrt(Math.Pow(text2.Location.X - Atributo1.XTubo, 2) + Math.Pow(text2.Location.Y - Atributo1.YTubo, 2));
                                                            if (distanciaTexto2 < distanciaMinima2)
                                                            {
                                                                distanciaMinima2 = distanciaTexto2;
                                                                itemSelecionado2 = text2;
                                                            }
                                                        }
                                                    }
                                                }
                                                if (itemSelecionado2 != null)
                                                {
                                                    var listaTexto2 = itemSelecionado2.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

                                                    string textoCA2 = listaTexto2.Where(d => d.Contains("CF=")).Any() ? listaTexto2.Where(p => p.Contains("CF=")).FirstOrDefault() : string.Empty;
                                                    textoCA2 = textoCA2.Replace("CF=", "");

                                                    Elevacao1.ElevacaoFinal = textoCA2;
                                                    Elevacao1.PosicaoX      = itemSelecionado2.Location.X;
                                                    Elevacao1.PosicaoY      = itemSelecionado2.Location.Y;
                                                }

                                                else
                                                {
                                                    editor.WriteMessage("\nAs Elevações não foram encontradas!");
                                                }

                                                _listaElevacao.Add(Elevacao1);
                                            }
                                            _lista.Add(Atributo1);
                                            break;
                                        }
                                    }
                                }
                                catch (Exception)
                                {
                                    continue;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                    }
                }
                acTrans.Commit();
            }
        }
示例#10
0
        public static void LerTodosOsBlocosEBuscarOsAtributos()
        {
            Document documentoAtivo = Application.DocumentManager.MdiActiveDocument;
            Database database       = documentoAtivo.Database;
            Editor   editor         = documentoAtivo.Editor;


            using (Transaction acTrans = documentoAtivo.TransactionManager.StartTransaction())
            {
                BlockTable blockTable;
                blockTable = acTrans.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable;

                //TypedValue[] acTypValAr = new TypedValue[0];
                // acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "BLOCK"),0);

                //SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);

                PromptSelectionResult pmtSelRes = editor.GetSelection();

                if (pmtSelRes.Status == PromptStatus.OK)
                {
                    _lista = new List <AtributosDoBloco>();

                    foreach (ObjectId id in pmtSelRes.Value.GetObjectIds())
                    {
                        try
                        {
                            AtributosDoBloco Atributo1 = new AtributosDoBloco();

                            foreach (string nome in ConstantesTubulacao.TubulacaoNomeDosBlocos)
                            {
                                BlockTableRecord blockTableRecord;
                                blockTableRecord = acTrans.GetObject(blockTable[nome], OpenMode.ForRead) as BlockTableRecord;

                                if (!blockTableRecord.IsDynamicBlock)
                                {
                                    return;
                                }

                                try
                                {
                                    if (blockTableRecord.IsDynamicBlock && blockTableRecord.Name.Equals(nome))
                                    {
                                        BlockReference bloco = acTrans.GetObject(id, OpenMode.ForRead) as BlockReference;

                                        DynamicBlockReferencePropertyCollection properties = bloco.DynamicBlockReferencePropertyCollection;

                                        BlockTableRecord nomeRealBloco = null;

                                        nomeRealBloco = acTrans.GetObject(bloco.DynamicBlockTableRecord, OpenMode.ForRead) as BlockTableRecord;

                                        if (!_lista.Any(b => b.Handle.ToString() == Atributo1.Handle))
                                        {
                                            for (int i = 0; i < properties.Count; i++)
                                            {
                                                DynamicBlockReferenceProperty property = properties[i];
                                                if (property.PropertyName == "Distance1")
                                                {
                                                    Atributo1.Distancia = property.Value.ToString();
                                                    _lista.Add(Atributo1);
                                                }
                                                Atributo1.X         = bloco.Position.X;
                                                Atributo1.Y         = bloco.Position.Y;
                                                Atributo1.NomeBloco = nomeRealBloco.Name;
                                                Atributo1.Handle    = bloco.Handle.ToString();
                                                Atributo1.Angulo    = bloco.Rotation;
                                                _lista.Add(Atributo1);

                                                var    lista    = Atributo1.NomeBloco.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                                                string diametro = lista.Where(p => p.Contains("TUBO FF DN ")).Any() ? lista.Where(p => p.Contains("TUBO FF DN ")).FirstOrDefault() : string.Empty;

                                                diametro = diametro.Replace("TUBO FF DN ", "");

                                                Atributo1.Diametro = diametro;

                                                double distancia = Convert.ToDouble(Atributo1.Distancia);

                                                double dimensaoFinalX;
                                                double dimensaoFinalY;

                                                if (bloco.Rotation < 1.5708)
                                                {
                                                    dimensaoFinalX = distancia * Math.Cos(bloco.Rotation);
                                                    dimensaoFinalY = distancia * Math.Sin(bloco.Rotation);

                                                    Atributo1.XTubo = bloco.Position.X + dimensaoFinalX;
                                                    Atributo1.YTubo = bloco.Position.Y + dimensaoFinalY;
                                                    _lista.Add(Atributo1);
                                                }
                                                else if (bloco.Rotation > 1.5708 && bloco.Rotation <= 3.14159265)
                                                {
                                                    dimensaoFinalX = distancia * Math.Sin(3.14159265 - bloco.Rotation);
                                                    dimensaoFinalY = distancia * Math.Cos(3.14159265 - bloco.Rotation);

                                                    Atributo1.XTubo = bloco.Position.X - dimensaoFinalX;
                                                    Atributo1.YTubo = bloco.Position.Y + dimensaoFinalY;
                                                    _lista.Add(Atributo1);
                                                }
                                                else if (bloco.Rotation > 3.14159265 && bloco.Rotation <= 4.71239)
                                                {
                                                    dimensaoFinalX = distancia * Math.Sin(4.71239 - bloco.Rotation);
                                                    dimensaoFinalY = distancia * Math.Cos(4.71239 - bloco.Rotation);

                                                    Atributo1.XTubo = bloco.Position.X - dimensaoFinalX;
                                                    Atributo1.YTubo = bloco.Position.Y - dimensaoFinalY;
                                                    _lista.Add(Atributo1);
                                                }
                                                else if (bloco.Rotation > 4.71239 && bloco.Rotation <= 6.28319)
                                                {
                                                    dimensaoFinalX = distancia * Math.Sin(6.28319 - bloco.Rotation);
                                                    dimensaoFinalY = distancia * Math.Cos(6.28319 - bloco.Rotation);

                                                    Atributo1.XTubo = bloco.Position.X + dimensaoFinalX;
                                                    Atributo1.YTubo = bloco.Position.Y - dimensaoFinalY;
                                                    _lista.Add(Atributo1);
                                                }
                                            }
                                        }
                                    }
                                }
                                catch (Exception)
                                {
                                    continue;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                    }
                }
                acTrans.Commit();
            }
        }