Ejemplo n.º 1
0
        public override int Execute(params string[] parameters)
        {
            var mainWindow = Autodesk.Navisworks.Api.Application.Gui.MainWindow;
            var appConfig  = AppConfigManager.Load();

            var dialog = new FormExportSvfzip(appConfig);

            dialog.ShowDialog(mainWindow);

            return(0);
        }
Ejemplo n.º 2
0
        Result IExternalCommand.Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

            var uiapp = commandData.Application;
            var uidoc = uiapp.ActiveUIDocument;
            var doc   = uidoc.Document;

            var view = doc.ActiveView as View3D;

            if (null == view)
            {
                ShowMessageBox(Strings.MessageOpen3DViewFirst);
                return(Result.Succeeded);
            }

            Dictionary <int, bool> elementIds;

            var elementSelected = uidoc.Selection.GetElementIds();

            if (elementSelected != null && elementSelected.Count > 0)
            {
                elementIds = new Dictionary <int, bool>(elementSelected.Count);
                foreach (var elementId in elementSelected)
                {
                    if (elementId == ElementId.InvalidElementId)
                    {
                        continue;
                    }
                    elementIds.Add(elementId.IntegerValue, true);
                }
            }
            else
            {
                elementIds = null;
            }

            var appConfig = AppConfigManager.Load();

            using (var licenseScope = new LicenseScope())
            {
                if (licenseScope.IsValid == false)
                {
                    return(Result.Succeeded);
                }

                var dialog = new FormExportSvfzip(licenseScope, view, appConfig, elementIds);
                dialog.ShowDialog();
            }

            return(Result.Succeeded);
        }