示例#1
0
        Result IExternalCommand.Execute(
            ExternalCommandData excmd,
            ref string mainmessage,
            ElementSet elemset)
        {
            CurrentApplication = excmd.Application;
            UiDocument         = CurrentApplication.ActiveUIDocument;
            CurrentDocument    = CurrentApplication.ActiveUIDocument.Document;

            // draw box for area or pick a named scope box
            var view = Create3DViewFromArea();

            if (view == null)
            {
                throw new CancellableException();
            }

            // create options for export
            var opts = new NavisworksExportOptions
            {
                ConvertElementProperties = true,
                Coordinates = NavisworksCoordinates.Shared,
                ExportLinks = true,
                ExportScope = NavisworksExportScope.View,
                ViewId      = CurrentDocument.ActiveView.Id
            };

            // if the export of a specific VIEW for each linked model doesn't work -
            // open other linked Revit models and create the same 3D for each

            // create folders and other variables
            var projFolder    = FindProjectFolder(CurrentDocument);
            var projNumber    = GetProjectNumber(projFolder);
            var navisFileName = $"{projNumber}_ALL";
            var fullNavPath   = Directory.GetParent(projFolder)?.Parent?.FullName + @"\NAVIS\" + navisFileName + ".nwc";
            var navisFolder   = Directory.GetParent(fullNavPath).FullName;

            // export to NWC
            const string testFolder = @"C:\_Revit\";

            CurrentDocument.Export(testFolder, navisFileName, opts);
            //CurrentDocument.Export(navisFolder, navisFileName, opts);

            // starts clash detection in separate thread
            //StartClashDetectionThread(fullNavPath);

            return(Result.Succeeded);

            // switch over to Navisworks context

            /*
             * Append all files
             * import Search Sets
             * import Clash Tests
             * Run Clash Tests
             * Split based on typical responsibility
             * Export to HTML
             * Export to Viewpoints
             */
        }