Esempio n. 1
0
        /// <summary>
        /// Returns corresponding reporty subscription schedule data
        /// </summary>
        /// <param name="reportSchedule"></param>
        /// <returns>Schedule xml</returns>
        public string GetMatchData(ReportSchedule reportSchedule)
        {
            ScheduleDefinition schedule = new ScheduleDefinition();

            //Make start date time as the begining of the current day
            schedule.StartDateTime = DateTime.Today.Add(reportSchedule.ScheduleTime);

            //if (reportSchedule.Expiration_Date_for_the_Schedule != null)
            //{
            //    if (schedule.StartDateTime < schedule.EndDate)
            //    {
            //        schedule.EndDateSpecified = true;
            //        schedule.EndDate = schedule.EndDate;
            //    }
            //    else
            //    {
            //        schedule.EndDate = schedule.StartDateTime.AddMinutes(20);
            //        schedule.EndDateSpecified = true;
            //    }
            //}
            //else
            //{
            //    schedule.EndDateSpecified = false;
            //}
            schedule.EndDateSpecified = false;
            schedule.Item             = GetPattern(reportSchedule.SchedulePeriod, reportSchedule.ScheduleDay);

            XmlDocument xmlDoc = GetScheduleAsXml(schedule);

            return(xmlDoc.OuterXml);
        }
        public string CreateSchedule(string Name, RSScheduleDefinition ScheduleDefinition, string SiteUrl)
        {
            ScheduleDefinition schedDef = (ScheduleDefinition)Converter.Convert(ScheduleDefinition);
            string             outval   = rs.CreateSchedule(Name, schedDef, SiteUrl);

            return(outval);
        }
Esempio n. 3
0
        private void UpdateFilter(string filterName,
                                  dynamic newValue, ScheduleDefinition scheduleDefinition)
        {
            ScheduleFilter filter = null;
            int            index  = 0;

            for (int i = 0; i < scheduleDefinition.GetFilterCount(); ++i)
            {
                ScheduleFilter curFilter = scheduleDefinition.GetFilter(i);
                ScheduleField  field     = scheduleDefinition.GetField(curFilter.FieldId);

                if (field.GetName().Equals(filterName))
                {
                    index  = i;
                    filter = curFilter;
                    break;
                }
            }

            if (newValue != null && filter != null && scheduleDefinition != null)
            {
                filter.SetValue(newValue);
                scheduleDefinition.SetFilter(index, filter);
            }
        }
Esempio n. 4
0
        private static ScheduleDefinition UtworzScheduleDefinition(Context context, Zadanie szablon)
        {
            var scheduleDefinition = new ScheduleDefinition();

            using (var session = context.Session.Login.CreateSession(false, true, "ScheduleDefinition"))
            {
                var coreModule     = CoreModule.GetInstance(session);
                var businessModule = BusinessModule.GetInstance(session);

                var taskDefinition = businessModule.TaskDefs.ByName["CfgNodes", "WysylkaMailiZWydrukiem"];

                using (var transaction = session.Logout(true))
                {
                    scheduleDefinition.Name           = $"Scheduler_{szablon.NumerPelny}";
                    scheduleDefinition.TaskDefinition = taskDefinition;

                    coreModule.ScheduleDefs.AddRow(scheduleDefinition);

                    transaction.CommitUI();
                }

                session.Save();
            }

            return(scheduleDefinition);
        }
Esempio n. 5
0
        public ScheduleController(ScheduleDefinition sd)
        {
            if (sd == null)
            {
                throw new ArgumentNullException("sd");
            }

            this.mSchedule = sd;
        }
Esempio n. 6
0
        private void HideEmptyColumns(ElementId id)
        {
            if (id == ElementId.InvalidElementId)
            {
                return;
            }

            ViewSchedule viewSchd = m_doc.GetElement(id)
                                    as ViewSchedule;
            ScheduleDefinition schdDef   = viewSchd.Definition;
            TableSectionData   tableData =
                viewSchd.GetTableData().GetSectionData(SectionType.Body);

            Func <ScheduleFieldId, bool> filterHiddenFields = delegate(ScheduleFieldId fId)
            {
                if (schdDef.GetField(fId).IsHidden)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            };

            IList <ScheduleFieldId> visibleFields = schdDef
                                                    .GetFieldOrder()
                                                    .Where(filterHiddenFields)
                                                    .ToList();

            StringBuilder strBld = new StringBuilder();

            for (int i = tableData.FirstColumnNumber + 2; i <= tableData.LastColumnNumber; ++i)
            {
                double sum = 0;

                for (int j = tableData.FirstRowNumber + 1; j <= tableData.LastRowNumber; ++j)
                {
                    string cellContent = tableData.GetCellText(j, i);
                    strBld.AppendFormat("({0}, {1}) = {2}\n", i, j, cellContent);
                    double cellValue;
                    if (Double.TryParse(cellContent, out cellValue))
                    {
                        sum += cellValue;
                    }
                }

                // if the current column holds no value, then have it hidden
                if (sum == 0)
                {
                    ScheduleField field = schdDef.GetField(visibleFields[i]);
                    field.IsHidden = true;
                }
            }
            System.Diagnostics.Trace.Write(strBld.ToString());
        }
Esempio n. 7
0
 public SubscriptionDetails(string scheduleId, string description, IEnumerable<ParameterValue> parameters, ScheduleDefinition scheduleDefinition, DeliverySettings deliverySettings, DateTime startDateTime, DateTime endDateTime)
 {
     ScheduleId = scheduleId;
     Description = description;
     Parameters = parameters;
     ScheduleDefinition = scheduleDefinition;
     DeliverySettings = deliverySettings;
     StartDateTime = startDateTime;
     EndDateTime = endDateTime;
 }
Esempio n. 8
0
      protected IFCImportCache(Document doc, string fileName)
      {
         // Get all categories of current document
         Settings documentSettings = doc.Settings;

         DocumentCategories = documentSettings.Categories;
         GenericModelsCategory = DocumentCategories.get_Item(BuiltInCategory.OST_GenericModel);

         ProjectInfo projectInfo = doc.ProjectInformation;
         ProjectInformationId = (projectInfo == null) ? ElementId.InvalidElementId : projectInfo.Id;

         // Cache the original shared parameters file, and create and read in a new one.
         OriginalSharedParametersFile = doc.Application.SharedParametersFilename;
         doc.Application.SharedParametersFilename = fileName + ".sharedparameters.txt";

         DefinitionFile definitionFile = doc.Application.OpenSharedParameterFile();
         if (definitionFile == null)
         {
            StreamWriter definitionFileStream = new StreamWriter(doc.Application.SharedParametersFilename, false);
            definitionFileStream.Close();
            definitionFile = doc.Application.OpenSharedParameterFile();
         }

         if (definitionFile == null)
            throw new InvalidOperationException("Can't create definition file for shared parameters, aborting import.");

         DefinitionInstanceGroup = definitionFile.Groups.get_Item("IFC Parameters");
         if (DefinitionInstanceGroup == null)
            DefinitionInstanceGroup = definitionFile.Groups.Create("IFC Parameters");

         DefinitionTypeGroup = definitionFile.Groups.get_Item("IFC Type Parameters");
         if (DefinitionTypeGroup == null)
            DefinitionTypeGroup = definitionFile.Groups.Create("IFC Type Parameters");

         // Cache list of schedules.
         FilteredElementCollector viewScheduleCollector = new FilteredElementCollector(doc);
         ICollection<Element> viewSchedules = viewScheduleCollector.OfClass(typeof(ViewSchedule)).ToElements();
         foreach (Element viewSchedule in viewSchedules)
         {
            ScheduleDefinition definition = (viewSchedule as ViewSchedule).Definition;
            if (definition == null)
               continue;

            ElementId categoryId = definition.CategoryId;
            if (categoryId == ElementId.InvalidElementId)
               continue;

            ViewSchedules[new KeyValuePair<ElementId, string>(categoryId, viewSchedule.Name)] = viewSchedule.Id;
            ViewScheduleNames.Add(viewSchedule.Name);
         }

         // Find the status bar, so we can add messages.
         StatusBar = RevitStatusBar.Create();
      }
Esempio n. 9
0
        public void DayCanBeSaved()
        {
            var dbMock = new DbMock();

            AlarmController ac       = new AlarmController(dbMock, dbMock, dbMock);
            var             schedule = new ScheduleDefinition();

            schedule.WeeklyPeriod.Period = 4;
            var day = new ScheduleSqlDefinition(schedule, "Foo", "Bar");

            ac.SaveWashDay(day);
            var restored = ac.LoadScheduleDatabase();

            Assert.AreEqual(4, restored["Foo"].Value.WeeklyPeriod.Period);
        }
Esempio n. 10
0
        public void WashDaysCanBeRead()
        {
            var dbMock = new DbMock();

            AlarmController ac       = new AlarmController(dbMock, dbMock, dbMock);
            var             schedule = new ScheduleDefinition();

            schedule.Type = ScheduleDefinition.ScheduleType.Dayly;
            schedule.DaylyPeriod.Period = 1;
            var day = new ScheduleSqlDefinition(schedule, "Foo", "Bar");

            ac.SaveWashDay(day);
            var days = ac.GetTodayWashDays();

            Assert.AreEqual(1, days.Count);
        }
Esempio n. 11
0
            internal FieldFilter(ViewSchedule vs, string paramName)
            {
                ParameterName = paramName;
                m_scheduleDef = vs.Definition;

                for (int i = 0; i < m_scheduleDef.GetFilterCount(); ++i)
                {
                    ScheduleFilter sFilter =
                        m_scheduleDef.GetFilter(i);

                    if (m_scheduleDef.GetField(sFilter.FieldId).GetName() == ParameterName)
                    {
                        Index  = i;
                        Filter = sFilter;
                    }
                }
            }
Esempio n. 12
0
        /// <summary>
        /// Generate XML Document from the schedule definition
        /// </summary>
        /// <param name="schedule"></param>
        /// <returns></returns>
        private XmlDocument GetScheduleAsXml(ScheduleDefinition schedule)
        {
            MemoryStream  buffer        = new MemoryStream();
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ScheduleDefinition));

            xmlSerializer.Serialize(buffer, schedule);
            buffer.Seek(0, SeekOrigin.Begin);

            XmlDocument doc = new XmlDocument();

            doc.Load(buffer);
            // patch up WhichWeek
            XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);

            ns.AddNamespace("rs",
                            "http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices");

            XmlNode node =
                doc.SelectSingleNode(
                    "/ScheduleDefinition/rs:MonthlyDOWRecurrence/rs:WhichWeek", ns
                    );

            if (node != null)
            {
                switch (node.InnerXml)
                {
                case "FirstWeek":
                    node.InnerXml = "FIRST_WEEK"; break;

                case "SecondWeek":
                    node.InnerXml = "SECOND_WEEK"; break;

                case "ThirdWeek":
                    node.InnerXml = "THIRD_WEEK"; break;

                case "FourthWeek":
                    node.InnerXml = "FOURTH_WEEK"; break;

                case "LastWeek":
                    node.InnerXml = "LAST_WEEK"; break;
                }
            }

            return(doc);
        }
Esempio n. 13
0
        void ChangeTitle(ViewSchedule vs, string assemblyName)
        {
            ScheduleDefinition sd       = vs.Definition;
            TableData          td       = vs.GetTableData();
            TableSectionData   tsd      = td.GetSectionData(SectionType.Header);
            string             oldValue = tsd.GetCellText(tsd.FirstRowNumber, tsd.FirstColumnNumber);

            Tracer.Write($"oldValue={oldValue}");
            string newValue = string.Empty;

            for (int i = 0; i < oldValue.Split(' ').Length - 1; i++)
            {
                newValue += oldValue.Split(' ')[i] + " ";
            }
            newValue += assemblyName;
            Tracer.Write($"newValue={newValue}");
            tsd.SetCellText(tsd.FirstRowNumber, tsd.FirstColumnNumber, newValue);
        }
Esempio n. 14
0
        /// <summary>
        /// Registers a group with the currently stored data.
        /// </summary>
        /// <param name="name">The name of the newly created group.</param>
        /// <returns>The registration ID of the group.</returns>
        public GroupRegistrationId Register(string name)
        {
            var definition = new GroupDefinition(name);

            definition.Parts = m_Objects.SelectMany(p => p.Value).ToList();
            definition.InternalConnections = m_Connections.Select(
                p => new PartImportToPartExportMap(p.Key, (IEnumerable <ExportRegistrationId>)p.Value));

            if (m_Schedule != null)
            {
                definition.Schedule = ScheduleDefinition.CreateDefinition(
                    definition.Id,
                    m_Schedule,
                    m_Actions.ToDictionary(p => p.Value, p => p.Key),
                    m_Conditions.ToDictionary(p => p.Value, p => p.Key));
            }

            if (m_GroupExport != null)
            {
                definition.GroupExport = GroupExportDefinition.CreateDefinition(
                    m_GroupExport.ContractName,
                    definition.Id,
                    NonLinkedExports());
            }

            if (m_GroupImports.Count > 0)
            {
                definition.GroupImports = m_GroupImports.Select(
                    i => GroupImportDefinition.CreateDefinition(
                        i.Value.ContractName,
                        definition.Id,
                        i.Value.InsertPoint,
                        i.Value.ObjectImports))
                                          .ToList();
            }

            Clear();

            m_Repository.AddGroup(definition, m_FileInfo);
            return(definition.Id);
        }
Esempio n. 15
0
        internal void HideZeroFieldsMaterialTakeOff()
        {
            ViewSchedule         viewSchedule  = m_doc.GetElement(m_createdScheduleId) as ViewSchedule;
            ScheduleDefinition   scheduleDef   = viewSchedule.Definition;
            TableData            tableData     = viewSchedule.GetTableData();
            TableSectionData     tableSecData  = tableData.GetSectionData(SectionType.Body);
            List <ScheduleField> visibleFields = scheduleDef.GetFieldOrder().Select(id => scheduleDef.GetField(id)).Where(f => !f.IsHidden).ToList();

            System.Text.StringBuilder strBld = new System.Text.StringBuilder();

            using (Transaction t = new Transaction(viewSchedule.Document))
            {
                t.Start("Hide Zeroed Fields");
                for (int i = tableSecData.FirstColumnNumber; i <= tableSecData.LastColumnNumber; ++i)
                {
                    if (tableSecData.GetCellText(tableSecData.FirstRowNumber + 5, i) == "0")
                    {
                        double total = 0;

                        for (int j = tableSecData.FirstRowNumber + 5; j <= tableSecData.LastRowNumber; ++j)
                        {
                            strBld.AppendFormat("{0} = {1}; column = {2}\n",
                                                tableSecData.GetCellText(tableSecData.FirstRowNumber + 4, i), tableSecData.GetCellText(j, i), i);
                            double tmp;
                            if (Double.TryParse(tableSecData.GetCellText(j, i), out tmp))
                            {
                                total += tmp;
                            }
                        }

                        if (total == 0)
                        {
                            visibleFields[i].IsHidden = true;
                        }
                    }
                }
                t.Commit();
            }
            Tracer.Write(strBld.ToString());
        }
Esempio n. 16
0
        /// <summary>
        /// Formats the schedule with alternating background colors
        /// </summary>
        /// <param name="viewSchedule"></param>
        public void FormatScheduleColumns(ViewSchedule viewSchedule)
        {
            ScheduleDefinition definition = viewSchedule.Definition;
            int index = 0;

            Color white          = new Color(0xFF, 0xFF, 0xFF);
            Color highlight      = new Color(0xd8, 0xd8, 0xd8);
            bool  applyHighlight = false;

            // Loop over fields in order
            foreach (ScheduleFieldId id in definition.GetFieldOrder())
            {
                // Index 0, 2, etc use highlight color
                if (index % 2 == 0)
                {
                    applyHighlight = true;
                }
                // Index 1, 3, etc use no background color
                else
                {
                    applyHighlight = false;
                }

                // Get the field style
                ScheduleField  field = definition.GetField(id);
                TableCellStyle style = field.GetStyle();
                TableCellStyleOverrideOptions options = style.GetCellStyleOverrideOptions();

                // Set override options for background color per requirement
                options.BackgroundColor = applyHighlight;
                style.SetCellStyleOverrideOptions(options);

                // Set background color per requirement
                style.BackgroundColor = applyHighlight ? highlight : white;
                field.SetStyle(style);

                index++;
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Adds a single parameter field to the schedule
        /// </summary>
        public static void AddRegularFieldToSchedule(Document doc, ViewSchedule schedule)
        {
            ScheduleDefinition definition = schedule.Definition;

            //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();

            // Find a matching SchedulableField
            //SchedulableField schedulableField = definition.GetSchedulableFields().FirstOrDefault<SchedulableField>();

            schedule.Name = sheet_number + " DNote Legend";
        }
 /// <remarks/>
 public void SetSchedulePropertiesAsync(string Name, string ScheduleID, ScheduleDefinition ScheduleDefinition, object userState)
 {
     if ((this.SetSchedulePropertiesOperationCompleted == null))
     {
         this.SetSchedulePropertiesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetSchedulePropertiesOperationCompleted);
     }
     this.InvokeAsync("SetScheduleProperties", new object[] {
                 Name,
                 ScheduleID,
                 ScheduleDefinition}, this.SetSchedulePropertiesOperationCompleted, userState);
 }
 /// <remarks/>
 public void SetSchedulePropertiesAsync(string Name, string ScheduleID, ScheduleDefinition ScheduleDefinition)
 {
     this.SetSchedulePropertiesAsync(Name, ScheduleID, ScheduleDefinition, null);
 }
 public void SetScheduleProperties(string Name, string ScheduleID, ScheduleDefinition ScheduleDefinition)
 {
     this.Invoke("SetScheduleProperties", new object[] {
                 Name,
                 ScheduleID,
                 ScheduleDefinition});
 }
Esempio n. 21
0
        private RevitDataTable GetRevitDataTable(ViewSchedule schedule)
        {
            ScheduleDefinition scheduleDefinition = schedule.Definition;
            TableSectionData   bodyData           = schedule.GetTableData().GetSectionData(SectionType.Body);
            TableSectionData   headerData         = schedule.GetTableData().GetSectionData(SectionType.Header);

            RevitDataTable   dataTable   = new RevitDataTable(schedule.Name);
            RevitDataSection dataSection = new RevitDataSection("Без названия");

            dataTable.Sections.Add(dataSection);
            // заголовки
            int start_i;

            if (scheduleDefinition.ShowHeaders)
            {
                RevitDataRow header = new RevitDataRow(0);
                for (int col = 0; col < bodyData.NumberOfColumns; col++)
                {
                    RevitDataCell dataCell = new RevitDataCell(
                        schedule.GetCellText(SectionType.Body, 0, col),
                        bodyData.GetCellType(0, col),
                        bodyData.GetCellParamId(col));
                    header.Cells.Add(dataCell);
                }
                start_i          = 1;
                dataTable.Header = header;
            }
            else
            {
                start_i = 0;
            }
            //ищем секции
            for (int row = start_i; row < bodyData.NumberOfRows; row++)
            {
                if (bodyData.GetCellType(row, 0) == CellType.Text &&
                    bodyData.GetMergedCell(row, 0).Right == bodyData.LastColumnNumber)
                {
                    string header = bodyData.GetCellText(row, 0);
                    header      = string.IsNullOrEmpty(header) ? "Без названия" : header;
                    dataSection = new RevitDataSection(header);
                    dataTable.Sections.Add(dataSection);
                    continue;
                }

                RevitDataRow dataRow = new RevitDataRow(row);
                for (int col = 0; col < bodyData.NumberOfColumns; col++)
                {
                    RevitDataCell dataCell = new RevitDataCell(
                        schedule.GetCellText(SectionType.Body, row, col),
                        bodyData.GetCellType(row, col),
                        bodyData.GetCellParamId(col));
                    dataRow.Cells.Add(dataCell);
                }
                dataSection.Rows.Add(dataRow);
            }
            if (dataTable["Без названия"].Rows.Count == 0)
            {
                dataTable.Sections.Remove(dataTable["Без названия"]);
            }
            return(dataTable);
        }
 /// <remarks/>
 public void CreateScheduleAsync(string Name, ScheduleDefinition ScheduleDefinition, object userState)
 {
     if ((this.CreateScheduleOperationCompleted == null))
     {
         this.CreateScheduleOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateScheduleOperationCompleted);
     }
     this.InvokeAsync("CreateSchedule", new object[] {
                 Name,
                 ScheduleDefinition}, this.CreateScheduleOperationCompleted, userState);
 }
 public string CreateSchedule(string Name, ScheduleDefinition ScheduleDefinition)
 {
     object[] results = this.Invoke("CreateSchedule", new object[] {
                 Name,
                 ScheduleDefinition});
     return ((string)(results[0]));
 }
Esempio n. 24
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Document           doc  = commandData.Application.ActiveUIDocument.Document;
            ViewSchedule       vs   = commandData.Application.ActiveUIDocument.ActiveView as ViewSchedule;
            ScheduleDefinition sdef = null;

            if (vs == null)
            {
                Selection sel = commandData.Application.ActiveUIDocument.Selection;
                if (sel.GetElementIds().Count == 0)
                {
                    return(Result.Failed);
                }
                ScheduleSheetInstance ssi = doc.GetElement(sel.GetElementIds().First()) as ScheduleSheetInstance;
                if (ssi == null)
                {
                    return(Result.Failed);
                }
                if (!ssi.Name.Contains("ВРС"))
                {
                    return(Result.Failed);
                }
                vs = doc.GetElement(ssi.ScheduleId) as ViewSchedule;
            }
            sdef = vs.Definition;


            int firstWeightCell   = 0;
            int startHiddenFields = 0;
            int borderCell        = 9999;

            //определяю первую и последнюю ячейку с массой
            for (int i = 0; i < sdef.GetFieldCount(); i++)
            {
                ScheduleField sfield   = sdef.GetField(i);
                string        cellName = sfield.GetName();
                if (firstWeightCell == 0)
                {
                    if (char.IsNumber(cellName[0]))
                    {
                        firstWeightCell = i;
                    }
                    else
                    {
                        if (sfield.IsHidden)
                        {
                            startHiddenFields++;
                        }
                    }
                }
                if (cellName.StartsWith("="))
                {
                    borderCell = i;
                    break;
                }
            }

            using (Transaction t = new Transaction(doc))
            {
                t.Start("Отобразить все ячейки");
                for (int i = firstWeightCell; i < borderCell; i++)
                {
                    ScheduleField sfield   = sdef.GetField(i);
                    string        cellName = sfield.GetName();
                    sfield.IsHidden = false;
                }


                doc.Regenerate();

                TableData        tdata = vs.GetTableData();
                TableSectionData tsd   = tdata.GetSectionData(SectionType.Body);
                int firstRownumber     = tsd.FirstRowNumber;
                int lastRowNumber      = tsd.LastRowNumber;
                int rowsCount          = lastRowNumber - firstRownumber;

                for (int i = firstWeightCell; i < borderCell; i++)
                {
                    ScheduleField sfield   = sdef.GetField(i);
                    string        cellName = sfield.GetName();

                    List <string> values = new List <string>();
                    for (int j = firstRownumber; j <= lastRowNumber; j++)
                    {
                        string cellText = tsd.GetCellText(j, i - startHiddenFields);
                        values.Add(cellText);
                    }

                    bool checkOnlyTextAndZeros = OnlyTextAndZeros(values);
                    if (checkOnlyTextAndZeros)
                    {
                        sfield.IsHidden = true;
                    }
                }
                t.Commit();
            }
            return(Result.Succeeded);
        }
 public ScheduleDefinitionGetFields(string label, ScheduleDefinition scheduleDefinition) : base(label)
 {
     _scheduleDefinition = scheduleDefinition;
 }
        public void SetScheduleProperties(string Name, string ScheduleID, RSScheduleDefinition ScheduleDefinition)
        {
            ScheduleDefinition schedDef = (ScheduleDefinition)Converter.Convert(ScheduleDefinition);

            rs.SetScheduleProperties(Name, ScheduleID, schedDef);
        }
Esempio n. 27
0
        /// <summary>
        /// Create a schedule for a given property set.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element being created.</param>
        /// <param name="category">The category of the element.</param>
        /// <param name="parameterGroupMap">The parameters of the element.  Cached for performance.</param>
        /// <param name="parametersCreated">The created parameters.</param>
        protected void CreateScheduleForPropertySet(Document doc, Element element, Category category,
                                                    IFCParameterSetByGroup parameterGroupMap, ISet <string> parametersCreated)
        {
            // Don't bother creating schedules if we are maximizing performance.
            if (IFCImportFile.TheFile.Options.UseStreamlinedOptions)
            {
                return;
            }

            if (parametersCreated.Count == 0)
            {
                return;
            }

            if (category == null)
            {
                return;
            }

            ElementId categoryId    = category.Id;
            bool      elementIsType = (element is ElementType);

            string cleanName = IFCNamingUtil.CleanIFCName(Name);
            Tuple <ElementId, bool, string> scheduleKey = Tuple.Create(categoryId, elementIsType, cleanName);

            ISet <string> viewScheduleNames = Importer.TheCache.ViewScheduleNames;
            IDictionary <Tuple <ElementId, bool, string>, ElementId> viewSchedules = Importer.TheCache.ViewSchedules;

            ElementId viewScheduleId;

            if (!viewSchedules.TryGetValue(scheduleKey, out viewScheduleId))
            {
                string scheduleName     = scheduleKey.Item3;
                string scheduleTypeName = elementIsType ? " " + Resources.IFCTypeSchedule : string.Empty;

                int index = 1;
                while (viewScheduleNames.Contains(scheduleName))
                {
                    string indexString = (index > 1) ? " " + index.ToString() : string.Empty;
                    scheduleName += " (" + category.Name + scheduleTypeName + indexString + ")";
                    index++;
                    if (index > 1000)
                    {
                        Importer.TheLog.LogWarning(Id, "Too many property sets with the name " + scheduleKey.Item3 +
                                                   ", no longer creating schedules with that name.", true);
                        return;
                    }
                }

                // Not all categories allow creating schedules.  Skip these.
                ViewSchedule viewSchedule = null;
                try
                {
                    viewSchedule = ViewSchedule.CreateSchedule(doc, scheduleKey.Item1);
                }
                catch
                {
                    // Only try to create the schedule once per key.
                    viewSchedules[scheduleKey] = ElementId.InvalidElementId;
                    return;
                }

                if (viewSchedule != null)
                {
                    viewSchedule.Name          = scheduleName;
                    viewSchedules[scheduleKey] = viewSchedule.Id;
                    viewScheduleNames.Add(scheduleName);

                    ElementId ifcGUIDId           = new ElementId(elementIsType ? BuiltInParameter.IFC_TYPE_GUID : BuiltInParameter.IFC_GUID);
                    string    propertySetListName = elementIsType ? Resources.IFCTypeSchedule + " IfcPropertySetList" : "IfcPropertySetList";

                    ScheduleDefinition       viewScheduleDefinition = viewSchedule.Definition;
                    IList <SchedulableField> schedulableFields      = viewScheduleDefinition.GetSchedulableFields();

                    bool filtered = false;
                    foreach (SchedulableField sf in schedulableFields)
                    {
                        string fieldName = sf.GetName(doc);
                        if (parametersCreated.Contains(fieldName) || sf.ParameterId == ifcGUIDId)
                        {
                            viewScheduleDefinition.AddField(sf);
                        }
                        else if (!filtered && fieldName == propertySetListName)
                        {
                            // We want to filter the schedule for specifically those elements that have this property set assigned.
                            ScheduleField scheduleField = viewScheduleDefinition.AddField(sf);
                            scheduleField.IsHidden = true;
                            ScheduleFilter filter = new ScheduleFilter(scheduleField.FieldId, ScheduleFilterType.Contains, "\"" + Name + "\"");
                            viewScheduleDefinition.AddFilter(filter);
                            filtered = true;
                        }
                    }
                }
            }

            return;
        }
Esempio n. 28
0
        // Create a new schedule
        public ViewSchedule CreateSchedule(string filePath, UIDocument uidoc)
        {
            ViewSchedule sched = null;

            _doc = uidoc.Document;

            if (uidoc.Document.IsWorkshared)
            {
                docPath = ModelPathUtils.ConvertModelPathToUserVisiblePath(uidoc.Document.GetWorksharingCentralModelPath());
            }
            else
            {
                docPath = uidoc.Document.PathName;
            }


            excelFilePath = filePath;
            if (File.Exists(excelFilePath))
            {
                // read the Excel file and create the schedule
                Excel.Application excelApp   = new Excel.Application();
                Excel.Workbook    workbook   = excelApp.Workbooks.Open(excelFilePath, ReadOnly: true);
                Excel.Sheets      worksheets = workbook.Worksheets;

                List <WorksheetObject> worksheetObjs = new List <WorksheetObject>();
                foreach (Excel.Worksheet ws in worksheets)
                {
                    WorksheetObject wo   = new WorksheetObject();
                    string          name = ws.Name;
                    wo.Name = name;
                    Excel.Range range = ws.UsedRange;
                    try
                    {
                        range.CopyPicture(Excel.XlPictureAppearance.xlPrinter, Excel.XlCopyPictureFormat.xlBitmap);
                        if (Clipboard.GetDataObject() != null)
                        {
                            IDataObject data = Clipboard.GetDataObject();
                            if (data.GetDataPresent(DataFormats.Bitmap))
                            {
                                System.Drawing.Image img = (System.Drawing.Image)data.GetData(DataFormats.Bitmap, true);
                                wo.Image = img;
                            }
                        }
                    }
                    catch { }
                    worksheetObjs.Add(wo);
                }

                // Pop up the worksheet form
                WorksheetSelectForm wsForm = new WorksheetSelectForm(worksheetObjs, this, _doc);


                // Revit version
                int version = Convert.ToInt32(uidoc.Application.Application.VersionNumber);

                // Get the Revit window handle
                IntPtr handle = IntPtr.Zero;
                if (version < 2019)
                {
                    handle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
                }
                else
                {
                    handle = uidoc.Application.GetType().GetProperty("MainWindowHandle") != null
                        ? (IntPtr)uidoc.Application.GetType().GetProperty("MainWindowHandle").GetValue(uidoc.Application)
                        : IntPtr.Zero;
                }
                System.Windows.Interop.WindowInteropHelper wih = new System.Windows.Interop.WindowInteropHelper(wsForm)
                {
                    Owner = handle
                };

                //Show the Worksheet Select form
                wsForm.ShowDialog();
                if (wsForm.DialogResult.HasValue && wsForm.DialogResult.Value)
                {
                    foreach (Excel.Worksheet ws in worksheets)
                    {
                        if (ws.Name == selectedWorksheet.Name)
                        {
                            worksheet = ws;
                            break;
                        }
                    }
                }
                else
                {
                    worksheet = null;
                }

                if (worksheet != null)
                {
                    workSheetName = worksheet.Name;
                    Transaction trans = new Transaction(_doc, "Create Schedule");
                    trans.Start();

                    // Create the schedule
                    sched      = ViewSchedule.CreateSchedule(_doc, new ElementId(-1));
                    sched.Name = worksheet.Name;

                    // Add a single parameter for data, Assembly Code
                    ElementId       assemblyCodeId = new ElementId(BuiltInParameter.UNIFORMAT_DESCRIPTION);
                    ScheduleFieldId fieldId        = null;
                    foreach (SchedulableField sField in sched.Definition.GetSchedulableFields())
                    {
                        ElementId paramId = sField.ParameterId;

                        if (paramId == assemblyCodeId)
                        {
                            ScheduleField field = sched.Definition.AddField(sField);
                            fieldId = field.FieldId;
                            break;
                        }
                    }

                    if (fieldId != null && sched.Definition.GetFieldCount() > 0)
                    {
                        ScheduleDefinition schedDef = sched.Definition;

                        // Add filters to hide all elements in the schedule, ie make sure nothing shows up in the body.
                        ScheduleFilter filter0 = new ScheduleFilter(fieldId, ScheduleFilterType.Equal, "NO VALUES FOUND");
                        ScheduleFilter filter1 = new ScheduleFilter(fieldId, ScheduleFilterType.Equal, "ALL VALUES FOUND");
                        schedDef.AddFilter(filter0);
                        schedDef.AddFilter(filter1);

                        // Turn off the headers
                        schedDef.ShowHeaders = false;

                        // Fill out the schedule from Excel data
                        AddScheduleData(filePath, sched, _doc, PathType.Absolute, false);
                    }



                    if (linkFile)
                    {
                        AssignSchemaData(sched.Id, workSheetName, _doc);
                    }

                    trans.Commit();
                }

                //workbook.Close();
                workbook.Close(false);
                Marshal.ReleaseComObject(worksheets);
                if (worksheet != null)
                {
                    Marshal.ReleaseComObject(worksheet);
                }
                Marshal.ReleaseComObject(workbook);
                excelApp.Quit();
                Marshal.ReleaseComObject(excelApp);
            }
            return(sched);
        }
 /// <remarks/>
 public System.IAsyncResult BeginCreateSchedule(string Name, ScheduleDefinition ScheduleDefinition, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("CreateSchedule", new object[] {
                 Name,
                 ScheduleDefinition}, callback, asyncState);
 }
Esempio n. 30
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            // Add an EventLogTraceListener object
            System.Diagnostics.Trace.Listeners.Add(
                new System.Diagnostics.EventLogTraceListener("Application"));

            // Lay the hands on the active document
            UIDocument uidoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            // Set up a timer
            Timing myTimer = new Timing();

            myTimer.StartTime();
            StringBuilder strBld = new StringBuilder();

            // Make some preparations
            List <ElementId> selectedElemIds = new List <ElementId>();
            EnumValuesWnd    wnd             = null;

            try
            {
                if (doc.ActiveView.ViewType != ViewType.Schedule)
                {
                    TaskDialog.Show("Exception", "Open a schedule view before running this command.");
                    return(Result.Failed);
                }
                else if (uidoc.Selection.GetElementIds().Count == 0)
                {
                    TaskDialog.Show("Exception", "No element has been picked out.");
                    return(Result.Failed);
                }

                selectedElemIds = uidoc.Selection.GetElementIds().ToList();
                ViewSchedule       scheduleView       = doc.ActiveView as ViewSchedule;
                ScheduleDefinition scheduleDefinition = scheduleView.Definition;
                bool             sorted  = scheduleDefinition.GetSortGroupFieldCount() > 0 ? true : false;
                List <TmpObject> tmpObjs = new List <TmpObject>();

                for (int i = 0; i < selectedElemIds.Count; ++i)
                {
                    Element   elem = doc.GetElement(selectedElemIds[i]);
                    TmpObject tmp  = new TmpObject(elem.Id);

                    for (int j = 0; j < scheduleDefinition.GetSortGroupFieldCount(); ++j)
                    {
                        ScheduleSortGroupField srtGrpField = scheduleDefinition.GetSortGroupField(j);
                        ScheduleField          schField    = scheduleDefinition.GetField(srtGrpField.FieldId);

                        Parameter p = GetScheduleFieldParameter(schField, elem);
                        if (p != null)
                        {
                            tmp.AddParameter(p);
                        }
                    }
                    tmpObjs.Add(tmp);
                }

                // Sort the elements by a series of parameters
                tmpObjs.Sort();

                // Create the window and subscribe to its event
                IList <string> parameterNames = doc.GetElement(selectedElemIds[0])
                                                .GetOrderedParameters()
                                                .Where(p => p.StorageType == StorageType.String && !p.IsReadOnly)
                                                .Select(p => p.Definition.Name)
                                                .ToList();

                wnd            = new EnumValuesWnd(parameterNames);
                wnd.OkClicked += (sender, args) =>
                {
                    using (Transaction t = new Transaction(doc))
                    {
                        t.Start("Enumerate parameters");

                        // Deal with the first element
                        TmpObject prevObj = tmpObjs[0];
                        doc.GetElement(prevObj.Id).LookupParameter(args.ParameterName).Set(
                            string.Format("{0}{1}{2}", args.Prefix, args.Position, args.Suffix));
                        int position = args.Position;

                        // See about the other elements in the list
                        for (int i = 1; i < tmpObjs.Count; ++i)
                        {
                            TmpObject curObj = tmpObjs[i];
                            Element   e      = doc.GetElement(curObj.Id);

                            if (curObj.CompareTo(prevObj) == 0 && sorted)
                            {
                                e.LookupParameter(args.ParameterName).Set(
                                    string.Format("{0}{1}{2}", args.Prefix, position, args.Suffix));
                            }
                            else
                            {
                                ++position;
                                e.LookupParameter(args.ParameterName).Set(
                                    string.Format("{0}{1}{2}", args.Prefix, position, args.Suffix));
                            }
                            prevObj = curObj;
                        }
                        t.Commit();
                    }
                };

                // Show the window
                wnd.ShowDialog();

                return(Result.Succeeded);
            }
            catch (Autodesk.Revit.Exceptions.OperationCanceledException)
            {
                return(Result.Cancelled);
            }
            catch (Exception ex)
            {
                TaskDialog.Show("Exception",
                                string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
                System.Diagnostics.Trace.Write(string.Format("{0}\n{1}",
                                                             ex.Message, ex.StackTrace));
                return(Result.Failed);
            }
            finally
            {
                wnd.Close();
                myTimer.StopTime();
                System.Diagnostics.Trace
                .Write(string.Format("Time elapsed: {0}s",
                                     myTimer.Duration.TotalSeconds));
            }
        }
 /// <remarks/>
 public System.IAsyncResult BeginSetScheduleProperties(string Name, string ScheduleID, ScheduleDefinition ScheduleDefinition, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("SetScheduleProperties", new object[] {
                 Name,
                 ScheduleID,
                 ScheduleDefinition}, callback, asyncState);
 }
Esempio n. 32
0
        private static ScheduleDefinition ScheduleDefinitionFromReportSchedulerModel(ReportSchedulerModel model)
        {
            var startDate = DateTime.Parse(model.StartDate, CultureInfo.CurrentCulture);
            var runtTime = DateTime.Parse(model.ScheduledTime, CultureInfo.CurrentCulture);
            var startDateTime = new DateTime(startDate.Year, startDate.Month, startDate.Day,
                                             runtTime.Hour, runtTime.Minute, runtTime.Second, DateTimeKind.Local);

            var recurrencePattern = new WeeklyRecurrence
            {
                WeeksIntervalSpecified = true,
                WeeksInterval = 1,
                DaysOfWeek =
                    model.ReportFrequency == ReportFrequency.Daily
                        ? DailyDaysOfWeek
                        : WeeklyDayOfWeek(model.Weekday)
            };

            var scheduleDefinition = new ScheduleDefinition
            {
                StartDateTime = startDateTime,
                EndDateSpecified = model.EndDateSpecified,
                Item = recurrencePattern
            };

            if (model.EndDateSpecified)
            {
                scheduleDefinition.EndDate = DateTime.Parse(model.EndDate, CultureInfo.CurrentCulture);
            }

            return scheduleDefinition;
        }
 /// <remarks/>
 public void CreateScheduleAsync(string Name, ScheduleDefinition ScheduleDefinition)
 {
     this.CreateScheduleAsync(Name, ScheduleDefinition, null);
 }
Esempio n. 34
0
 private static WeeklyRecurrencePattern WeeklyRecurrencePatternFromScheduleDefintion(ScheduleDefinition scheduleDefinition)
 {
     var weeklyRecurrance = (WeeklyRecurrence)scheduleDefinition.Item;
     return weeklyRecurrance.WeeklyRecurrencePattern();
 }
Esempio n. 35
0
        public QaqcCSVRequest(UIApplication uiApp, String text)
        {
            //Prepare a DataTable just for this operation
            DataTable  dt              = new DataTable();
            DataColumn paramIdColumn   = dt.Columns.Add("ID", typeof(Int32));
            DataColumn paramNameColumn = dt.Columns.Add("Name", typeof(String));
            DataColumn paramElemColumn = dt.Columns.Add("Element", typeof(Object));

            //Create some lists for collecting data
            List <string>    fieldNamesCollection = new List <string>();
            List <Parameter> elementParameters    = new List <Parameter>();
            List <DataRow>   duplicateRows        = new List <DataRow>();
            List <ElementId> idsToUpdate          = new List <ElementId>();
            List <string>    failList             = new List <string>();


            RVTDocument doc = uiApp.ActiveUIDocument.Document;
            //Give a dialog box to verify the user has synchronized model changes, and only proceed if they click Yes
            DialogResult result = MessageBox.Show("Have you synchronized your model changes?", "Synchronization Prompt", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                //Double check the active view is a schedule
                if (doc.ActiveView.ViewType == ViewType.Schedule)
                {
                    ViewSchedule viewSchedule = doc.ActiveView as ViewSchedule;
                    //Collect all of the elements displayed in the schedule
                    var scheduleCollector = new FilteredElementCollector(doc, doc.ActiveView.Id).ToElements();
                    //Get the number of fields in the schedule
                    ScheduleDefinition scheduleDefinition = viewSchedule.Definition;
                    int scheduleFieldCount = scheduleDefinition.GetFieldCount();
                    for (int i = 0; i < scheduleFieldCount; i++)
                    {
                        //Get the fields and replace "Material: " in any name because those come from Material elemements that just have parameters with normal names
                        ScheduleField scheduleField = scheduleDefinition.GetField(i);
                        fieldNamesCollection.Add(scheduleField.GetName().Replace("Material: ", ""));
                    }

                    //For each element in the schedule...
                    foreach (Element elem in scheduleCollector)
                    {
                        //Get every instance parameter for the element and add it to the list of parameters to evaluate
                        foreach (Parameter instanceParam in elem.Parameters)
                        {
                            elementParameters.Add(instanceParam);

                            //Also, add a new row to the DataTable with the parameter ID, parameter Name, and the parameter Element
                            DataRow row = dt.NewRow();
                            row["ID"]      = instanceParam.Id.IntegerValue;
                            row["Name"]    = instanceParam.Definition.Name;
                            row["Element"] = instanceParam;
                            dt.Rows.Add(row);
                        }

                        //Then, get the type parameters of each element
                        ElementId typeId      = elem.GetTypeId();
                        Element   typeElement = doc.GetElement(typeId);
                        try
                        {
                            //For each type parameter, add it to the list of parameters to evaluate
                            foreach (Parameter typeParameter in typeElement.Parameters)
                            {
                                elementParameters.Add(typeParameter);

                                //Also, add a new row to the DataTable with the parameter ID, parameter Name, and parameter Element
                                DataRow row = dt.NewRow();
                                row["ID"]      = typeParameter.Id.IntegerValue;
                                row["Name"]    = typeParameter.Definition.Name;
                                row["Element"] = typeParameter;
                                dt.Rows.Add(row);
                            }
                        }
                        catch { continue; }
                    }

                    //Get the list of distinct parameters
                    List <Parameter> elementParameterList = elementParameters.Distinct().ToList();

                    //Make a new HashTable
                    Hashtable hashTable = new Hashtable();
                    //Cycle through the rows in the DataTable
                    foreach (DataRow row in dt.Rows)
                    {
                        if (hashTable.Contains(row["ID"]))
                        {
                            //If the hash table already contains the parameter ID of the row being evaluated, add the row to the list of duplicate rows
                            duplicateRows.Add(row);
                        }
                        else
                        {
                            //Otherwise, add the parameter ID to the hash table for further evaluations
                            hashTable.Add(row["ID"], null);
                        }
                    }

                    //For each row in the list of duplicate rows, delete them from the DataTable
                    foreach (DataRow item in duplicateRows)
                    {
                        dt.Rows.Remove(item);
                    }


                    //With a DataTable of unique parameters, start a transaction
                    Transaction t1 = new Transaction(doc, "CapitalizeScheduleValues");
                    t1.Start();
                    //For each row in the DataTable...
                    foreach (DataRow row in dt.Rows)
                    {
                        try
                        {
                            //If the list of field names contains the parameter name in the row...
                            if (fieldNamesCollection.Contains(row["Name"].ToString()))
                            {
                                Parameter rowParam = row["Element"] as Parameter;
                                //Get the parameter of the row and verify its data type is a string, and it is not read only
                                if (rowParam.StorageType == StorageType.String && !rowParam.IsReadOnly)
                                {
                                    //Add to the list of parameter IDs to update the ID of the parameter in the row
                                    idsToUpdate.Add(new ElementId(Convert.ToInt32(row["ID"])));
                                }
                            }
                        }
                        catch { continue; }
                    }

                    //For each Element in the schedule...
                    foreach (Element elem in scheduleCollector)
                    {
                        try
                        {
                            //For each parameter in the list of parameters
                            foreach (Parameter param in elementParameterList)
                            {
                                //If the list of parameter IDs to update contains the parameter in the list, and the parameter value is not null...
                                if (idsToUpdate.Contains(param.Id) && param.AsString() != null)
                                {
                                    //If the element happens to be a view with brackets it will be skipped because a name value cannot be set with brackets
                                    if (!param.AsString().Contains("{") && !param.AsString().Contains("}"))
                                    {
                                        try
                                        {
                                            //Try setting the parameter's value to an all caps value
                                            param.Set(param.AsString().ToUpper());
                                        }
                                        catch
                                        {
                                            //Otherwise add the parameter's name to a list for failed capitalizations
                                            failList.Add(param.Definition.Name);
                                            continue;
                                        }
                                    }
                                }
                            }
                        }
                        catch { continue; }
                    }
                    t1.Commit();
                }

                else
                {
                    //If the active view is not a schedule view, let the user know
                    MessageBox.Show(String.Format("The currently active view is of type: {0}. " +
                                                  "Please make the desired schedule the active view by clicking into the schedule view and rerun the script",
                                                  doc.ActiveView.ViewType.ToString()));
                }
            }
            else if (result == DialogResult.No)
            {
                //If the user selected No when asked if they synchronized, remind them to synchronize and try again
                MessageBox.Show("Please synchronize and/or save the model, then run again");
            }
            else
            {
                ;
            }

            //If there were any failures, output the list of parameter names that failed to a string in a MessageBox
            if (failList.Count > 1)
            {
                string failMessage = StringOperations.BuildStringFromList(failList).ToString();
                MessageBox.Show(String.Format("Could not convert the following parameters: {0}", failMessage));
            }
        }
Esempio n. 36
0
 private static ReportFrequency? ReportFrequencyFromScheduleDefinition(ScheduleDefinition scheduleDefinition)
 {
     var weeklyRecurrance = scheduleDefinition.Item as WeeklyRecurrence;
     //The scheduleDefinition.Item may not be a WeeklyRecurrence, but we don't support that.
     //In that event we just default to null.
     if (weeklyRecurrance == null) return null;
     return weeklyRecurrance.ReportFrequency();
 }
Esempio n. 37
0
        /// <summary>
        /// Получаем спецификацию
        /// </summary>
        private void GetSchedule()
        {
            // Получаем выбранный элемент
            var selection = _uidoc
                            .Selection
                            .GetElementIds()
                            .Select(i => _doc.GetElement(i))
                            .FirstOrDefault();

            // Если элемент является спецификацией запишем спецификацию
            if (selection is ScheduleSheetInstance)
            {
                _scheduleSheetInstance = selection as ScheduleSheetInstance;
                _viewSchedule          = (ViewSchedule)_doc.GetElement(_scheduleSheetInstance.ScheduleId);

                // Проверка является ли спецификация ведомостью деталей
                if (!_scheduleSheetInstance.Name.Contains("Ведомость деталей"))
                {
                    TaskDialog.Show("Ошибка", "Выбрана не ведомость деталей");
                    return;
                }
            }

            // Если элемент яляется группой то расскидаем значения
            else if (selection is Group)
            {
                var listElement = ((Group)selection)
                                  .GetMemberIds()
                                  .Select(i => _doc.GetElement(i))
                                  .ToList();
                _scheduleSheetInstance = listElement
                                         .Where(i => i is ScheduleSheetInstance)
                                         .Cast <ScheduleSheetInstance>()
                                         .ToList()
                                         .FirstOrDefault();
                if (_scheduleSheetInstance == null)
                {
                    TaskDialog.Show("Ошибка", "В группе нет спецификации");
                    return;
                }

                // Проверка является ли спецификация ведомостью деталей
                if (!_scheduleSheetInstance.Name.Contains("Ведомость деталей"))
                {
                    TaskDialog.Show("Ошибка", "Выбрана не ведомость деталей");
                    return;
                }
                _viewSchedule         = (ViewSchedule)_doc.GetElement(_scheduleSheetInstance.ScheduleId);
                _annotationSymbolList = listElement
                                        .Where(i => i is AnnotationSymbol)
                                        .Cast <AnnotationSymbol>()
                                        .ToList();
            }
            else
            {
                TaskDialog.Show("Ошибка", "Не выбрана спецификация или группа со спецификацией");
                return;
            }
            // Получаем объект TableSectionData
            _tsd = _viewSchedule.GetTableData().GetSectionData(SectionType.Body);

            // Получаем баундингБокс
            _boundingBox = _scheduleSheetInstance.get_BoundingBox(_doc.ActiveView);

            // Получаем представление спецификации
            _scheduleDefinition = _viewSchedule.Definition;
        }
 /// <remarks/>
 public void CreateScheduleAsync(string Name, ScheduleDefinition ScheduleDefinition, string SiteUrl)
 {
     this.CreateScheduleAsync(Name, ScheduleDefinition, SiteUrl, null);
 }