예제 #1
0
#pragma warning restore 414

        public FormExport(AppConfig config, Options options)
            : this()
        {
            _Options             = options ?? new Options();
            _Options.WinFormMode = false;

            _Config      = config;
            _LocalConfig = _Config.Svf;

            if (_Options.Features == null || !_Options.Features.Any())
            {
                _Options.Features = new[]
                {
                    FeatureType.ExportMode2D.ToString(),
                        FeatureType.ExportMode3D.ToString(),
                        FeatureType.IncludeInvisibleLayers.ToString(),
                        FeatureType.IncludeLayouts.ToString(),
                        FeatureType.GenerateThumbnail.ToString(),
                        FeatureType.GenerateModelsDb.ToString()
                };
            }

            _Features = new List <FeatureInfo>
            {
                new FeatureInfo(FeatureType.ExportMode2D, Strings.FeatureNameExportMode2D, Strings.FeatureDescriptionExportMode2D),
                new FeatureInfo(FeatureType.ExportMode3D, Strings.FeatureNameExportMode3D, Strings.FeatureDescriptionExportMode3D),
                new FeatureInfo(FeatureType.IncludeInvisibleLayers, Strings.FeatureNameIncludeInvisibleLayers, Strings.FeatureDescriptionIncludeInvisibleLayers),
                new FeatureInfo(FeatureType.IncludeLayouts, Strings.FeatureNameIncludeLayouts, Strings.FeatureDescriptionIncludeLayouts),
                new FeatureInfo(FeatureType.GenerateModelsDb, Strings.FeatureNameGenerateModelsDb, Strings.FeatureDescriptionGenerateModelsDb),
                new FeatureInfo(FeatureType.GenerateThumbnail, Strings.FeatureNameGenerateThumbnail, Strings.FeatureDescriptionGenerateThumbnail),
                new FeatureInfo(FeatureType.GenerateLeaflet, Strings.FeatureNameGenerateLeaflet, Strings.FeatureDescriptionGenerateLeaflet)
            };
        }
예제 #2
0
        void IExportControl.Init(AppConfig config)
        {
            _Config      = config;
            _LocalConfig = _Config.Svf;

            _Features = new List <FeatureInfo>
            {
                new FeatureInfo(FeatureType.ExcludeProperties, Strings.FeatureNameExcludeProperties, Strings.FeatureDescriptionExcludeProperties),
                new FeatureInfo(FeatureType.ExcludeTexture, Strings.FeatureNameExcludeTexture, Strings.FeatureDescriptionExcludeTexture, true, false),
                new FeatureInfo(FeatureType.ExcludeLines, Strings.FeatureNameExcludeLines, Strings.FeatureDescriptionExcludeLines),
                new FeatureInfo(FeatureType.ExcludePoints, Strings.FeatureNameExcludePoints, Strings.FeatureDescriptionExcludePoints, true, false),
                new FeatureInfo(FeatureType.OnlySelected, Strings.FeatureNameOnlySelected, Strings.FeatureDescriptionOnlySelected),
                new FeatureInfo(FeatureType.GenerateElementData, Strings.FeatureNameGenerateElementData, Strings.FeatureDescriptionGenerateElementData),
                new FeatureInfo(FeatureType.GenerateModelsDb, Strings.FeatureNameGenerateModelsDb, Strings.FeatureDescriptionGenerateModelsDb),
                new FeatureInfo(FeatureType.GenerateThumbnail, Strings.FeatureNameGenerateThumbnail, Strings.FeatureDescriptionGenerateThumbnail),
                new FeatureInfo(FeatureType.ExportHyperlink, Strings.FeatureNameExportHyperlink, Strings.FeatureDescriptionExportHyperlink),
                new FeatureInfo(FeatureType.ReduceGeometryNode, Strings.FeatureNameReduceGeometryNode, Strings.FeatureDescriptionReduceGeometryNode),
            };

            _VisualStyles = new List <VisualStyleInfo>();
            _VisualStyles.Add(new VisualStyleInfo(@"Colored", Strings.VisualStyleColored + $@"({Strings.TextDefault})", new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, true }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Textured", Strings.VisualStyleTextured, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, false }
            }));
            _VisualStyleDefault = _VisualStyles.First(x => x.Key == @"Colored");

            cbVisualStyle.Items.Clear();
            cbVisualStyle.Items.AddRange(_VisualStyles.Select(x => (object)x).ToArray());
        }
예제 #3
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="uidoc"></param>
        /// <param name="view"></param>
        /// <param name="localConfig"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="useShareTexture"></param>
        /// <param name="progressCallback"></param>
        /// <param name="viewIds"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(UIDocument uidoc, View3D view, AppConfigSvf localConfig, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, bool useShareTexture, Action <int> progressCallback, List <int> viewIds, CancellationToken cancellationToken)
        {
#if EXPRESS
            throw new NotImplementedException();
#else
            using (var log = new RuntimeLog())
            {
                var featureList   = features?.Where(x => x.Value).Select(x => x.Key).ToList() ?? new List <FeatureType>();
                var elementIdList = _ElementIds?.Where(x => x.Value).Select(x => x.Key).ToList();

                var exporter = new Bimangle.ForgeEngine.Revit.Pro.Svf.Exporter(InnerApp.GetHomePath());

                if (uidoc != null && uidoc.ActiveView.Id == view.Id)
                {
                    exporter.Export(
                        uidoc, view,
                        localConfig.LevelOfDetail, localConfig.LastTargetPath, exportType, outputStream,
                        featureList, elementIdList, viewIds,
                        log, progressCallback, cancellationToken
                        );
                }
                else
                {
                    exporter.Export(
                        view,
                        localConfig.LevelOfDetail, localConfig.LastTargetPath, exportType, outputStream,
                        featureList, elementIdList, viewIds,
                        log, progressCallback, cancellationToken
                        );
                }
            }
#endif
        }
예제 #4
0
        private static void ApplyOptionsToConfigSvf(Options options, AppConfigSvf config)
        {
            config.LastTargetPath = options.OutputFolderPath ?? config.LastTargetPath;

            if (options.Features != null && options.Features.Any())
            {
                config.Features = new List <Common.Formats.Svf.Dwg.FeatureType>();

                foreach (var feature in options.Features)
                {
                    if (Enum.TryParse(feature, true,
                                      out Common.Formats.Svf.Dwg.FeatureType value))
                    {
                        config.Features.Add(value);
                    }
                }
            }
        }
예제 #5
0
#pragma warning restore 414

        public FormExport(AppConfig config, Options options)
            : this()
        {
            _Options             = options ?? new Options();
            _Options.WinFormMode = false;

            _Config      = config;
            _LocalConfig = _Config.Svf;

            if (options == null)
            {
                _Options.InputFilePath    = _LocalConfig.InputFilePath;
                _Options.OutputFolderPath = _LocalConfig.LastTargetPath;
                _Options.Features         = _LocalConfig.Features?.Select(x => x.ToString()).ToList();
            }

            if (_Options.Features == null || !_Options.Features.Any())
            {
                _Options.Features = new[]
                {
                    FeatureType.ExportMode2D.ToString(),
                        FeatureType.ExportMode3D.ToString(),
                        FeatureType.IncludeLayouts.ToString(),
                        FeatureType.GenerateThumbnail.ToString(),
                        FeatureType.GenerateModelsDb.ToString()
                };
            }

            _Features = new List <FeatureInfo>
            {
                new FeatureInfo(FeatureType.ExportMode2D, Strings.FeatureNameExportMode2D, Strings.FeatureDescriptionExportMode2D),
                new FeatureInfo(FeatureType.ExportMode3D, Strings.FeatureNameExportMode3D, Strings.FeatureDescriptionExportMode3D),
                new FeatureInfo(FeatureType.IncludeInvisibleLayers, Strings.FeatureNameIncludeInvisibleLayers, Strings.FeatureDescriptionIncludeInvisibleLayers),
                new FeatureInfo(FeatureType.IncludeLayouts, Strings.FeatureNameIncludeLayouts, Strings.FeatureDescriptionIncludeLayouts),
                new FeatureInfo(FeatureType.GenerateModelsDb, Strings.FeatureNameGenerateModelsDb, Strings.FeatureDescriptionGenerateModelsDb),
                new FeatureInfo(FeatureType.GenerateThumbnail, Strings.FeatureNameGenerateThumbnail, Strings.FeatureDescriptionGenerateThumbnail),
                new FeatureInfo(FeatureType.GenerateLeaflet, Strings.FeatureNameGenerateLeaflet, Strings.FeatureDescriptionGenerateLeaflet),
                new FeatureInfo(FeatureType.UseDefaultViewport, Strings.FeatureNameUseDefaultViewport, Strings.FeatureDescriptionUseDefaultViewport),
                new FeatureInfo(FeatureType.IncludeUnplottableLayers, Strings.FeatureNameIncludeUnplottableLayers, Strings.FeatureDescriptionIncludeUnplottableLayers),
                new FeatureInfo(FeatureType.OptimizationLineStyle, Strings.FeatureNameOptimizationLineStyle, Strings.FeatureDescriptionOptimizationLineStyle)
            };
        }
예제 #6
0
        void IExportControl.Init(UIDocument uidoc, View3D view, AppConfig config, Dictionary <int, bool> elementIds)
        {
            _UIDocument  = uidoc;
            _View        = view;
            _Config      = config;
            _LocalConfig = _Config.Svf;
            _ElementIds  = elementIds;
            _ViewIds     = null;

            _Features = new List <FeatureInfo>
            {
                new FeatureInfo(FeatureType.ExcludeProperties, Strings.FeatureNameExcludeProperties, Strings.FeatureDescriptionExcludeProperties),
                new FeatureInfo(FeatureType.ExcludeTexture, Strings.FeatureNameExcludeTexture, Strings.FeatureDescriptionExcludeTexture, true, false),
                new FeatureInfo(FeatureType.ExcludeLines, Strings.FeatureNameExcludeLines, Strings.FeatureDescriptionExcludeLines),
                new FeatureInfo(FeatureType.ExcludePoints, Strings.FeatureNameExcludePoints, Strings.FeatureDescriptionExcludePoints, true, false),
                new FeatureInfo(FeatureType.UseLevelCategory, Strings.FeatureNameUseLevelCategory, Strings.FeatureDescriptionUseLevelCategory),
                new FeatureInfo(FeatureType.UseNwLevelCategory, Strings.FeatureNameUseNwLevelCategory, Strings.FeatureDescriptionUseNwLevelCategory),
                new FeatureInfo(FeatureType.UseBoundLevelCategory, Strings.FeatureNameUseBoundLevelCategory, Strings.FeatureDescriptionUseBoundLevelCategory),
                new FeatureInfo(FeatureType.OnlySelected, Strings.FeatureNameOnlySelected, Strings.FeatureDescriptionOnlySelected),
                new FeatureInfo(FeatureType.GenerateElementData, Strings.FeatureNameGenerateElementData, Strings.FeatureDescriptionGenerateElementData),
                new FeatureInfo(FeatureType.ExportGrids, Strings.FeatureNameExportGrids, Strings.FeatureDescriptionExportGrids),
                new FeatureInfo(FeatureType.ExportRooms, Strings.FeatureNameExportRooms, Strings.FeatureDescriptionExportRooms),
                new FeatureInfo(FeatureType.ConsolidateGroup, Strings.FeatureNameConsolidateGroup, Strings.FeatureDescriptionConsolidateGroup),
                new FeatureInfo(FeatureType.ConsolidateAssembly, Strings.FeatureNameConsolidateAssembly, Strings.FeatureDescriptionConsolidateAssembly),
                new FeatureInfo(FeatureType.Wireframe, Strings.FeatureNameWireframe, Strings.FeatureDescriptionWireframe, true, false),
                new FeatureInfo(FeatureType.Gray, Strings.FeatureNameGray, Strings.FeatureDescriptionGray, true, false),
                new FeatureInfo(FeatureType.GenerateModelsDb, Strings.FeatureNameGenerateModelsDb, Strings.FeatureDescriptionGenerateModelsDb),
                new FeatureInfo(FeatureType.GenerateThumbnail, Strings.FeatureNameGenerateThumbnail, Strings.FeatureDescriptionGenerateThumbnail),
                new FeatureInfo(FeatureType.UseCurrentViewport, Strings.FeatureNameUseCurrentViewport, Strings.FeatureDescriptionUseCurrentViewport),
                new FeatureInfo(FeatureType.UseViewOverrideGraphic, Strings.FeatureNameUseViewOverrideGraphic, Strings.FeatureDescriptionUseViewOverrideGraphic, true, false),
                new FeatureInfo(FeatureType.UseBasicRenderColor, string.Empty, string.Empty, true, false),
                new FeatureInfo(FeatureType.Export2DViewOnlySheet, Strings.FeatureNameExport2DViewOnlySheet, Strings.FeatureDescriptionExport2DViewOnlySheet),
                new FeatureInfo(FeatureType.Export2DViewAll, Strings.FeatureNameExport2DViewAll, Strings.FeatureDescriptionExport2DViewAll),
                new FeatureInfo(FeatureType.GenerateLeaflet, Strings.FeatureNameGenerateLeaflet, Strings.FeatureDescriptionGenerateLeaflet),
                new FeatureInfo(FeatureType.GenerateDwgDrawing, Strings.FeatureNameGenerateDwgDrawing, Strings.FeatureDescriptionGenerateDwgDrawing),
            };

            _VisualStyles = new List <VisualStyleInfo>();
            _VisualStyles.Add(new VisualStyleInfo(@"Wireframe", Strings.VisualStyleWireframe, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, true },
                { FeatureType.Wireframe, true },
                { FeatureType.UseViewOverrideGraphic, false },
                { FeatureType.UseBasicRenderColor, false },
                { FeatureType.Gray, false }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Gray", Strings.VisualStyleGray, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, true },
                { FeatureType.Wireframe, false },
                { FeatureType.UseViewOverrideGraphic, false },
                { FeatureType.UseBasicRenderColor, false },
                { FeatureType.Gray, true }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Colored", Strings.VisualStyleColored, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, true },
                { FeatureType.Wireframe, false },
                { FeatureType.UseViewOverrideGraphic, true },
                { FeatureType.UseBasicRenderColor, false },
                { FeatureType.Gray, false }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Textured", Strings.VisualStyleTextured + $@"({Strings.TextDefault})", new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, false },
                { FeatureType.Wireframe, false },
                { FeatureType.UseViewOverrideGraphic, false },
                { FeatureType.UseBasicRenderColor, true },
                { FeatureType.Gray, false }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Realistic", Strings.VisualStyleRealistic, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, false },
                { FeatureType.Wireframe, false },
                { FeatureType.UseViewOverrideGraphic, false },
                { FeatureType.UseBasicRenderColor, false },
                { FeatureType.Gray, false }
            }));
            _VisualStyleDefault = _VisualStyles.First(x => x.Key == @"Textured");

            _LevelOfDetails = new List <ComboItemInfo>();
            _LevelOfDetails.Add(new ComboItemInfo(-1, Strings.TextAuto));
            for (var i = 0; i <= 15; i++)
            {
                string text;
                switch (i)
                {
                case 0:
                    text = $@"{i} ({Strings.TextLowest})";
                    break;

                case 8:
                    text = $@"{i} ({Strings.TextNormal})";
                    break;

                case 15:
                    text = $@"{i} ({Strings.TextHighest})";
                    break;

                default:
                    text = i.ToString();
                    break;
                }

                _LevelOfDetails.Add(new ComboItemInfo(i, text));
            }
            _LevelOfDetailDefault = _LevelOfDetails.Find(x => x.Value == -1);

            cbVisualStyle.Items.Clear();
            cbVisualStyle.Items.AddRange(_VisualStyles.Select(x => (object)x).ToArray());

            cbLevelOfDetail.Items.Clear();
            cbLevelOfDetail.Items.AddRange(_LevelOfDetails.Select(x => (object)x).ToArray());
        }
예제 #7
0
        void IExportControl.Init(Viewport view, AppConfig config, bool hasSelectElements)
        {
            _View              = view;
            _Config            = config;
            _LocalConfig       = _Config.Svf;
            _HasSelectElements = hasSelectElements;

            _Features = new List <FeatureInfo>
            {
                new FeatureInfo(FeatureType.ExcludeProperties, Strings.FeatureNameExcludeProperties, Strings.FeatureDescriptionExcludeProperties),
                new FeatureInfo(FeatureType.ExcludeTexture, Strings.FeatureNameExcludeTexture, Strings.FeatureDescriptionExcludeTexture, true, false),
                new FeatureInfo(FeatureType.ExcludeLines, Strings.FeatureNameExcludeLines, Strings.FeatureDescriptionExcludeLines),
                new FeatureInfo(FeatureType.ExcludePoints, Strings.FeatureNameExcludePoints, Strings.FeatureDescriptionExcludePoints, true, false),
                new FeatureInfo(FeatureType.OnlySelected, Strings.FeatureNameOnlySelected, Strings.FeatureDescriptionOnlySelected),
                new FeatureInfo(FeatureType.GenerateElementData, Strings.FeatureNameGenerateElementData, Strings.FeatureDescriptionGenerateElementData),
                new FeatureInfo(FeatureType.Wireframe, Strings.FeatureNameWireframe, Strings.FeatureDescriptionWireframe, true, false),
                new FeatureInfo(FeatureType.Gray, Strings.FeatureNameGray, Strings.FeatureDescriptionGray, true, false),
                new FeatureInfo(FeatureType.GenerateModelsDb, Strings.FeatureNameGenerateModelsDb, Strings.FeatureDescriptionGenerateModelsDb),
                new FeatureInfo(FeatureType.GenerateThumbnail, Strings.FeatureNameGenerateThumbnail, Strings.FeatureDescriptionGenerateThumbnail),
                new FeatureInfo(FeatureType.UseCurrentViewport, Strings.FeatureNameUseCurrentViewport, Strings.FeatureDescriptionUseCurrentViewport),
                new FeatureInfo(FeatureType.UseViewOverrideGraphic, Strings.FeatureNameUseViewOverrideGraphic, Strings.FeatureDescriptionUseViewOverrideGraphic, true, false),
                new FeatureInfo(FeatureType.UseBasicRenderColor, string.Empty, string.Empty, true, false),
                new FeatureInfo(FeatureType.RegroupForLink, Strings.FeatureNameRegroupForLink, Strings.FeatureDescriptionRegroupForLink),
            };

            _VisualStyles = new List <VisualStyleInfo>();
            _VisualStyles.Add(new VisualStyleInfo(@"Wireframe", Strings.VisualStyleWireframe, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, true },
                { FeatureType.Wireframe, true },
                { FeatureType.UseViewOverrideGraphic, false },
                { FeatureType.UseBasicRenderColor, false },
                { FeatureType.Gray, false }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Gray", Strings.VisualStyleGray, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, true },
                { FeatureType.Wireframe, false },
                { FeatureType.UseViewOverrideGraphic, false },
                { FeatureType.UseBasicRenderColor, false },
                { FeatureType.Gray, true }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Colored", Strings.VisualStyleColored, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, true },
                { FeatureType.Wireframe, false },
                { FeatureType.UseViewOverrideGraphic, true },
                { FeatureType.UseBasicRenderColor, false },
                { FeatureType.Gray, false }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Textured", Strings.VisualStyleTextured + $@"({Strings.TextDefault})", new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, false },
                { FeatureType.Wireframe, false },
                { FeatureType.UseViewOverrideGraphic, false },
                { FeatureType.UseBasicRenderColor, true },
                { FeatureType.Gray, false }
            }));
            _VisualStyles.Add(new VisualStyleInfo(@"Realistic", Strings.VisualStyleRealistic, new Dictionary <FeatureType, bool>
            {
                { FeatureType.ExcludeTexture, false },
                { FeatureType.Wireframe, false },
                { FeatureType.UseViewOverrideGraphic, false },
                { FeatureType.UseBasicRenderColor, false },
                { FeatureType.Gray, false }
            }));
            _VisualStyleDefault = _VisualStyles.First(x => x.Key == @"Textured");

            _LevelOfDetails = new List <ComboItemInfo>();
            _LevelOfDetails.Add(new ComboItemInfo(-1, Strings.TextAuto));
            for (var i = 0; i <= 15; i++)
            {
                string text;
                switch (i)
                {
                case 0:
                    text = $@"{i} ({Strings.TextLowest})";
                    break;

                case 8:
                    text = $@"{i} ({Strings.TextNormal})";
                    break;

                case 15:
                    text = $@"{i} ({Strings.TextHighest})";
                    break;

                default:
                    text = i.ToString();
                    break;
                }

                _LevelOfDetails.Add(new ComboItemInfo(i, text));
            }
            _LevelOfDetailDefault = _LevelOfDetails.Find(x => x.Value == -1);

            cbVisualStyle.Items.Clear();
            cbVisualStyle.Items.AddRange(_VisualStyles.Select(x => (object)x).ToArray());

            cbLevelOfDetail.Items.Clear();
            cbLevelOfDetail.Items.AddRange(_LevelOfDetails.Select(x => (object)x).ToArray());
        }