예제 #1
0
        /// <summary>
        /// Agrega un nuevo texto al documento actual.
        /// </summary>
        /// <param name="TextString">Texto a mostrar</param>
        /// <param name="P_XYZ">Coordenadas del texto (X,Y,Z).</param>
        /// <param name="Width">Ancho del texto.</param>
        ///  <param name="Height">Alto del texto.</param>
        /// <param name="Layer">Capa del texto.</param>
        /// <param name="Style">Estilo del texto.</param>
        /// <param name="Rotation">Ángulo de rotación del texto en grados.</param>
        /// <param name="LineTypeSacale">Tipo de escala de la linea.</param>
        /// <param name="Width2">Ancho del cuadro de Texto.</param>
        /// <param name="justifyText">Justificación del Texto.</param>

        public static void AddText(string TextString, double[] P_XYZ, double Width, double Height, string Layer, string Style, float Rotation, double LineTypeSacale = 1, double Width2 = 1.3, JustifyText justifyText = JustifyText.Left)
        {
            if (AcadDoc != null)
            {
                AcadMText text = AcadDoc.ModelSpace.AddMText(P_XYZ, Width, TextString);
                text.Layer           = Layer;
                text.StyleName       = Style;
                text.Height          = Height;
                text.Rotation        = Rotation * Math.PI / 180;
                text.LinetypeScale   = LineTypeSacale;
                text.Width           = Width2;
                text.AttachmentPoint = Clasf_JustyText(justifyText);
                text.Update();
            }
        }
        /// <summary>
        /// Agrega un nuevo texto al documento actual.
        /// </summary>
        /// <param name="TextString">Texto a mostrar</param>
        /// <param name="P_XY">Coordenadas del texto (X,Y) [System.Drawing].</param>
        /// <param name="Width">Ancho del texto.</param>
        ///  <param name="Height">Alto del texto.</param>
        /// <param name="Layer">Capa del texto.</param>
        /// <param name="Style">Estilo del texto.</param>
        /// <param name="Rotation">Ángulo de rotación del texto en grados.</param>
        /// <param name="LineTypeSacale">Tipo de escala de la linea.</param>
        /// <param name="Width2">Ancho del cuadro de Texto.</param>
        /// <param name="JustifyText">Justificación del Texto.</param>

        public static void AddText(string TextString, PointF P_XY, double Width, double Height, string Layer, string Style, float Rotation, double LineTypeSacale = 1, double Width2 = 1.3, JustifyText JustifyText = JustifyText.Left)
        {
            if (AcadDoc != null)
            {
                try
                {
                    AcadMText text = AcadDoc.ModelSpace.AddMText(ConvertirPuntoEnDobules3D(P_XY), Width, TextString);
                    text.Layer           = Layer;
                    text.StyleName       = Style;
                    text.Height          = Height;
                    text.Rotation        = Rotation * Math.PI / 180;
                    text.LinetypeScale   = LineTypeSacale;
                    text.Width           = Width2;
                    text.AttachmentPoint = Clasf_JustyText(JustifyText);
                    text.Update();
                }
                catch
                {
                    NotificadorErrores?.Invoke("Error inesperado.");
                }
            }
        }