Цитата |
---|
SwnSerg написал: Подскажите, пожалуйста, каким образом можно обновить все открытые документы в сессии T-Flex CAD? |
макрос регенерации открытых документов:
Код |
---|
using System.Collections.Generic;
using System.Windows.Forms;
using TFlex.Model;
namespace Test
{
public class Class5
{
static List<Document> documents = new List<Document>();
public static void Run()
{
Document activedocument = TFlex.Application.ActiveDocument;
if (activedocument != null)
{
RegenerateOptions options = new RegenerateOptions();
options.Full = true;
options.UpdateAllLinks = true;
options.UpdateBillOfMaterials = true;
foreach (var doc in GetDocuments())
{
doc.BeginChanges("Регенерация документа " + doc.FileName);
doc.Regenerate(options);
doc.EndChanges();
}
activedocument.Activate();
documents.Clear();
}
else
{
MessageBox.Show("Не обнаружен активный документ.",
"T-FLEX CAD", MessageBoxButtons.OK, MessageBoxIcon.Question);
}
}
static List<Document> GetDocuments()
{
foreach (Document d in TFlex.Application.Documents)
{
if (d.ActiveView != null)
{
documents.Add(d);
}
}
return documents;
}
}
}
|