Example #1
0
        //Create the Note Block Schedule
        public static void CreateDNoteLegend(Document doc, ElementId symbolId)
        {
            ViewSchedule vs = null;

            using (Transaction transaction = new Transaction(doc, "Creating Note BLock"))
            {
                if (!symbolId.Equals(ElementId.InvalidElementId))
                {
                    transaction.Start();

                    //Create a note-block view schedule.
                    vs = ViewSchedule.CreateNoteBlock(doc, symbolId);

                    AddRegularFieldToSchedule(doc, vs);
                }

                if (null != vs)
                {
                    transaction.Commit();
                }
                else
                {
                    transaction.RollBack();
                }
            }
        }
        /// <summary>
        /// Create a NoteBlock schedule
        /// </summary>
        public void CreateDNoteBlock(UIDocument uidoc, ElementId symbolId)
        {
            Document doc = uidoc.Document;

            List <ViewSchedule> schedules = new List <ViewSchedule>();

            //Check to make sure the user is on a sheet otherwise cancel
            View activeView = doc.ActiveView;

            if (!(activeView is ViewSheet))
            {
                TaskDialog.Show("ERROR!", "You must be on a sheet to create a DNote Legend");
            }

            //Get the active sheet number
            Parameter activeSheetNumber;

            activeSheetNumber = activeView.get_Parameter(BuiltInParameter.SHEET_NUMBER);
            string sheet_number = activeSheetNumber.AsString();

            //Create an empty view schedule of wall category.
            //ViewSchedule schedule = ViewSchedule.CreateSchedule(document, new ElementId(BuiltInCategory.OST_Walls), ElementId.InvalidElementId);

            //Create a note-block view schedule.
            ViewSchedule schedule = ViewSchedule.CreateNoteBlock(doc, symbolId);

            schedule.Name = sheet_number + " DNote Legend";
            schedules.Add(schedule);
        }