예제 #1
0
        private void RefreshForbidden(CreateJournalSetting setting)
        {
            var forbidden = CreateJournalManager.ForbiddenFiles(setting);

            ForbiddenFiles = GetList(forbidden);
        }
예제 #2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var app = commandData.Application;

            if (app is null)
            {
                message = "No application object";
                return(Result.Failed);
            }

            var uiDoc = app.ActiveUIDocument;

            if (uiDoc is null)
            {
                message = "No opent UIDocument";
                return(Result.Failed);
            }

            var doc = uiDoc.Document;

            if (doc is null)
            {
                message = "No open Document";
                return(Result.Failed);
            }

            if (doc.IsFamilyDocument == false)
            {
                message = "No family Document";
                return(Result.Failed);
            }

            try
            {
                var viewModel = new DocumentationViewModel();
                var view      = new DocumentationView {
                    DataContext = viewModel
                };
                var dialog = new WpfDialog(view);

                var manager = new CreateJournalManager(commandData);
                if (manager.CanReadData == false)
                {
                    dialog.ShowDialog();
                }
                if (manager.CanReadData || dialog.DialogResult == true)
                {
                    var setting = viewModel.Settings;
                    var tran    = new Transaction(doc, "Family Documentation");
                    try
                    {
                        tran.Start();
                        manager.CreateDocumentation(doc, setting);
                        tran.Commit();
                        return(Result.Succeeded);
                    }
                    catch (Exception ex)
                    {
                        tran.RollBack();
                        throw ex;
                    }
                }
                else
                {
                    return(Result.Cancelled);
                }
            }
            catch (Exception ex)
            {
                message = $"Error: {ex.Message}\nStack: {ex.StackTrace}";
                return(Result.Failed);
            }
        }
예제 #3
0
        private void RefreshAllowed(CreateJournalSetting setting)
        {
            var allwowed = CreateJournalManager.AllowedFiles(setting);

            AllowedFiles = new ObservableCollection <RevitFile>(allwowed);
        }