예제 #1
0
파일: HVAC.cs 프로젝트: yazmolod/TerrTools
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            // Стандарт
            doc = commandData.Application.ActiveUIDocument.Document;
            if (!CheckDefaultSharedParameters())
            {
                return(Result.Failed);
            }
            LoggingMachine.Reset();

            List <FamilyInstance> allPlunts = GetPlunts();

            if (allPlunts.Count < 1)
            {
                TaskDialog.Show("Ошибка", "Не найден ни один радиатор");
                return(Result.Failed);
            }
            using (Transaction tr = new Transaction(doc, "Обновление радиаторов"))
            {
                tr.Start();
                SetSpaces(allPlunts);
                tr.Commit();
                tr.Start();
                UpdatePluntData(allPlunts);
                tr.Commit();
                tr.Start();
                UpdatePluntGeometry(allPlunts);
                tr.Commit();
            }

            LoggingMachine.Show();

            return(Result.Succeeded);
        }
예제 #2
0
 static public void Show(bool showEmpty = false)
 {
     foreach (var error in Stack)
     {
         if (!showEmpty && error.FailedElementIds.Count() == 0)
         {
             continue;
         }
         string     allErrorIds = String.Join(", ", error.FailedElementIds);
         TaskDialog dialog      = new TaskDialog("Результат");
         if (error.AllElementIds != null)
         {
             dialog.MainInstruction = String.Format("Операция: {0}\nТип ошибки: {1}\nНеудачно: {2} из {3}",
                                                    error.Operation, error.ErrorType, error.FailedElementIds.Count(), error.AllElementIds.Count());
         }
         else
         {
             dialog.MainInstruction = String.Format("Операция: {0}\nТип ошибки: {1}\nНеудачно: {2}",
                                                    error.Operation, error.ErrorType, error.FailedElementIds.Count());
         }
         dialog.MainContent = "Перечень id элементов:\n"
                              + allErrorIds;
         dialog.FooterText = error.Tip;
         dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Скопировать ID элементов в буфер обмена");
         TaskDialogResult result = dialog.Show();
         if (result == TaskDialogResult.CommandLink1)
         {
             System.Windows.Forms.Clipboard.SetText(allErrorIds);
             TaskDialog.Show("Результат", "Данные успешно скопированы в буфер обмена");
         }
     }
     LoggingMachine.Reset();
 }