public static void ExportCesium3DTiles(string unparsed) { using (AssemblyResolver.Use()) { try { var view = Session.GetActiveViewport(); var hasSelectElements = SelectionSetManager.NumSelected() > 0; var appConfig = AppConfigManager.Load(); var dialog = new FormExport(view, appConfig, hasSelectElements, Titles.CESIUM_3D_TILES); dialog.ShowDialog(); } catch (Exception ex) { Log(ex.ToString()); } } }
public override int ExecuteCommand(string name, params string[] parameters) { var mainWindow = Autodesk.Navisworks.Api.Application.Gui.MainWindow; try { switch (name) { #if !EXPRESS case @"ButtonExportToSvfzip": { var appConfig = AppConfigManager.Load(); var dialog = new FormExport(appConfig, TITLE_SVF); dialog.ShowDialog(mainWindow); break; } #endif case @"ButtonExportToGltf": { var appConfig = AppConfigManager.Load(); var dialog = new FormExport(appConfig, TITLE_GLTF); dialog.ShowDialog(mainWindow); break; } case @"ButtonExportToCesium3DTiles": { var appConfig = AppConfigManager.Load(); var dialog = new FormExport(appConfig, TITLE_3DTILES); dialog.ShowDialog(mainWindow); break; } } } catch (Exception ex) { MessageBox.Show(mainWindow, ex.ToString(), @"Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(0); }
public static void ExportSvfzip(string unparsed) { #if EXPRESS Log(@"Unsupported function: 'Export Svfzip'"); #else using (AssemblyResolver.Use()) { try { var view = Session.GetActiveViewport(); var hasSelectElements = SelectionSetManager.NumSelected() > 0; var appConfig = AppConfigManager.Load(); var dialog = new FormExport(view, appConfig, hasSelectElements, Titles.SVFZIP); dialog.ShowDialog(); } catch (Exception ex) { Log(ex.ToString()); } } #endif }
Result IExternalCommand.Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements) { 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; } try { #if R2014 uidoc.Selection.Elements?.Clear(); #else uidoc.Selection.SetElementIds(new List <ElementId>()); #endif Application.DoEvents(); var appConfig = AppConfigManager.Load(); var dialog = new FormExport(uidoc, view, appConfig, elementIds, TITLE); dialog.ShowDialog(); } finally { #if R2014 if (elementSelected != null && elementSelected.Count > 0) { foreach (var elementId in elementSelected) { var element = doc.GetElement(elementId); uidoc.Selection.Elements?.Add(element); } } #else uidoc.Selection.SetElementIds(elementSelected); #endif } return(Result.Succeeded); }
public static void RunExport() { FormExport formExport = new FormExport(); formExport.ShowDialog(); }