Example #1
0
        /// <summary>
        /// Creates a new sheet.
        /// </summary>
        /// <param name="titleblock">The titleblock to use.</param>
        /// <returns name="Sheet">The newly created sheet.</returns>
        /// <search>
        /// sheet,rhythm
        /// </search>
        public static global::Revit.Elements.Element Create(global::Revit.Elements.FamilyType titleblock)
        {
            Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument;
            TransactionManager.Instance.EnsureInTransaction(doc);
            ElementId titleblockId = new ElementId(titleblock.Id);
            ViewSheet createdSheet = ViewSheet.Create(doc, titleblockId);
            var       result       = createdSheet.ToDSType(true);

            TransactionManager.Instance.TransactionTaskDone();

            return(result);
        }
Example #2
0
        /// <summary>
        /// New Family Instance by Curve
        /// </summary>
        /// <param name="familyType">Family Type to be applied to new Family Instance.</param>
        /// <param name="line">Line to place Family Instance at.</param>
        /// <param name="level">Level to associate Family Instance with.</param>
        /// <returns>New Family Instance.</returns>
        public static FamilyInstance ByLine(global::Revit.Elements.FamilyType familyType, Line line, global::Revit.Elements.Level level)
        {
            if (familyType == null)
            {
                throw new ArgumentNullException(nameof(familyType));
            }

            var symbol       = familyType.InternalElement as Autodesk.Revit.DB.FamilySymbol;
            var locationLine = line.ToRevitType() as Autodesk.Revit.DB.Line;
            var hostLevel    = level.InternalElement as Autodesk.Revit.DB.Level;

            return(new FamilyInstance(symbol, locationLine, hostLevel));
        }