Exemple #1
0
 public static TextNoteType Wrap(Autodesk.Revit.DB.TextNoteType ele, bool isRevitOwned)
 {
     return(TextNoteType.FromExisting(ele, isRevitOwned));
 }
Exemple #2
0
        /// <summary>
        /// Construct a new Revit TextNote by Location
        /// </summary>
        /// <param name="view">View to place text element on</param>
        /// <param name="location">Location in view</param>
        /// <param name="text">Text</param>
        /// <param name="alignment">Text alignment</param>
        /// <param name="keepRotatedTextReadable">Keep text horizontal</param>
        /// <param name="rotation">Rotation in degrees</param>
        /// <param name="type">Revit TextNote Type</param>
        /// <returns></returns>
        public static TextNote ByLocation(Revit.Elements.Views.View view, Autodesk.DesignScript.Geometry.Point location, string text, string alignment, [DefaultArgument("Revit.Elements.TextNoteType.Default()")] TextNoteType type, bool keepRotatedTextReadable = true, double rotation = 0)
        {
            RVT.HorizontalTextAlignment horizontalTextAlignmentStyle = HorizontalTextAlignment.Center;
            if (!Enum.TryParse <RVT.HorizontalTextAlignment>(alignment, out horizontalTextAlignmentStyle))
            {
                horizontalTextAlignmentStyle = HorizontalTextAlignment.Center;
            }

            Autodesk.Revit.DB.View revitView = (Autodesk.Revit.DB.View)view.InternalElement;

            if (!view.IsAnnotationView())
            {
                throw new Exception(Properties.Resources.ViewDoesNotSupportAnnotations);
            }

            return(new TextNote(revitView, location.ToRevitType(true), horizontalTextAlignmentStyle, text, keepRotatedTextReadable, rotation, type.InternalElement.Id));
        }