Data class which stores the main information for exporting dxf format
Inheritance: ExportDataWithViews
        /// <summary>
        /// Specify a file to export into
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonBrowser_Click(object sender, EventArgs e)
        {
            String fileName    = String.Empty;
            int    filterIndex = -1;

            DialogResult result = MainData.ShowSaveDialog(m_exportData, ref fileName, ref filterIndex);

            if (result != DialogResult.Cancel)
            {
                textBoxSaveAs.Text = fileName;
                if (m_exportData.ExportFormat == ExportFormat.DWG)
                {
                    ExportDWGData exportDWGData = m_exportData as ExportDWGData;
                    exportDWGData.ExportFileVersion = exportDWGData.EnumFileVersion[filterIndex - 1];
                }
                else if (m_exportData.ExportFormat == ExportFormat.DXF)
                {
                    ExportDXFData exportDXFData = m_exportData as ExportDXFData;
                    exportDXFData.ExportFileVersion = exportDXFData.EnumFileVersion[filterIndex - 1];
                }
            }
        }
        /// <summary>
        /// Export according to selected format
        /// </summary>
        /// <param name="selectedFormat">Selected format</param>
        public DialogResult Export(string selectedFormat)
        {
            ExportFormat format = GetSelectedExportFormat(selectedFormat);
            DialogResult dialogResult = DialogResult.OK;

            try
            {
                switch (format)
                {
                    case ExportFormat.DWG:
                        ExportDWGData exportDWGData = new ExportDWGData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDWGData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.DXF:
                        ExportDXFData exportDXFData = new ExportDXFData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDXFData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.SAT:
                        ExportSATData exportSATData = new ExportSATData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportSATData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.DWF:
                    case ExportFormat.DWFx:
                        ExportDWFData exportDWFData = new ExportDWFData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDWFData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.GBXML:
                        ExportGBXMLData exportGBXMLData = new ExportGBXMLData(m_commandData, format);
                        dialogResult = Export(exportGBXMLData);
                        break;
                    case ExportFormat.FBX:
                        ExportFBXData exportFBXData = new ExportFBXData(m_commandData, format);
                        dialogResult = Export(exportFBXData);
                        break;
                    case ExportFormat.DGN:
                        ExportDGNData exportDGNData = new ExportDGNData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDGNData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.Civil3D:
                        ExportCivil3DData exportCivil3DData = new ExportCivil3DData(m_commandData, format);
                        if (exportCivil3DData.DataValidated)
                        {
                            using (ExportCivil3DForm exportForm = new ExportCivil3DForm(exportCivil3DData))
                            {
                                dialogResult = exportForm.ShowDialog();
                            }
                        }
                        break;
                    case ExportFormat.Image:
                        ExportIMGData exportIMGdata = new ExportIMGData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportIMGdata))
                        {
                            dialogResult = DialogResult.OK;
                        }
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                String errorMessage = "Failed to export " + format + " format" + ex.ToString(); ;
                TaskDialog.Show("Error", errorMessage, TaskDialogCommonButtons.Ok);
            }

            return dialogResult;
        }
Beispiel #3
0
        /// <summary>
        /// Export according to selected format
        /// </summary>
        /// <param name="selectedFormat">Selected format</param>
        public DialogResult Export(string selectedFormat)
        {
            ExportFormat format       = GetSelectedExportFormat(selectedFormat);
            DialogResult dialogResult = DialogResult.OK;

            try
            {
                switch (format)
                {
                case ExportFormat.DWG:
                    ExportDWGData exportDWGData = new ExportDWGData(m_commandData, format);
                    using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDWGData))
                    {
                        dialogResult = exportForm.ShowDialog();
                    }
                    break;

                case ExportFormat.DXF:
                    ExportDXFData exportDXFData = new ExportDXFData(m_commandData, format);
                    using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDXFData))
                    {
                        dialogResult = exportForm.ShowDialog();
                    }
                    break;

                case ExportFormat.SAT:
                    ExportSATData exportSATData = new ExportSATData(m_commandData, format);
                    using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportSATData))
                    {
                        dialogResult = exportForm.ShowDialog();
                    }
                    break;

                case ExportFormat.DWF:
                case ExportFormat.DWFx:
                    ExportDWFData exportDWFData = new ExportDWFData(m_commandData, format);
                    using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDWFData))
                    {
                        dialogResult = exportForm.ShowDialog();
                    }
                    break;

                case ExportFormat.GBXML:
                    ExportGBXMLData exportGBXMLData = new ExportGBXMLData(m_commandData, format);
                    dialogResult = Export(exportGBXMLData);
                    break;

                case ExportFormat.FBX:
                    ExportFBXData exportFBXData = new ExportFBXData(m_commandData, format);
                    dialogResult = Export(exportFBXData);
                    break;

                case ExportFormat.DGN:
                    ExportDGNData exportDGNData = new ExportDGNData(m_commandData, format);
                    using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDGNData))
                    {
                        dialogResult = exportForm.ShowDialog();
                    }
                    break;

                case ExportFormat.Civil3D:
                    ExportCivil3DData exportCivil3DData = new ExportCivil3DData(m_commandData, format);
                    if (exportCivil3DData.DataValidated)
                    {
                        using (ExportCivil3DForm exportForm = new ExportCivil3DForm(exportCivil3DData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                    }
                    break;

                case ExportFormat.Image:
                    ExportIMGData exportIMGdata = new ExportIMGData(m_commandData, format);
                    using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportIMGdata))
                    {
                        dialogResult = DialogResult.OK;
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                String errorMessage = "Failed to export " + format + " format" + ex.ToString();;
                TaskDialog.Show("Error", errorMessage, TaskDialogCommonButtons.Ok);
            }

            return(dialogResult);
        }
        /// <summary>
        /// Provide the export option dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonOptions_Click(object sender, EventArgs e)
        {
            // Export dwg
            if (m_exportData.ExportFormat == ExportFormat.DWG)
            {
                bool contain3DView = false;

                if (radioButtonCurrentView.Checked)
                {
                    if (m_exportData.Is3DView)
                    {
                        contain3DView = true;
                    }
                }
                else
                {
                    if (m_exportData.SelectViewsData.Contain3DView)
                    {
                        contain3DView = true;
                    }
                }

                ExportDWGData exportDWGData = m_exportData as ExportDWGData;
                using (ExportBaseOptionsForm exportOptionsForm = new ExportBaseOptionsForm(exportDWGData.ExportOptionsData,
                                                                                           contain3DView, "DWG"))
                {
                    exportOptionsForm.ShowDialog();
                }
            }
            //Export dxf
            else if (m_exportData.ExportFormat == ExportFormat.DXF)
            {
                bool contain3DView = false;

                if (radioButtonCurrentView.Checked)
                {
                    if (m_exportData.Is3DView)
                    {
                        contain3DView = true;
                    }
                }
                else
                {
                    if (m_exportData.SelectViewsData.Contain3DView)
                    {
                        contain3DView = true;
                    }
                }

                ExportDXFData exportDXFData = m_exportData as ExportDXFData;

                using (ExportBaseOptionsForm exportOptionsForm = new ExportBaseOptionsForm(exportDXFData.ExportOptionsData,
                                                                                           contain3DView, "DXF"))
                {
                    exportOptionsForm.ShowDialog();
                }
            }
            // Export dgn
            else if (m_exportData.ExportFormat == ExportFormat.DGN)
            {
                ExportDGNData exportDGNData = m_exportData as ExportDGNData;
                using (ExportDGNOptionsForm exportOptionsForm = new ExportDGNOptionsForm(exportDGNData))
                {
                    exportOptionsForm.ShowDialog();
                }
            }

            // Export DWF
            else
            {
                ExportDWFData exportDWFData = m_exportData as ExportDWFData;
                using (ExportDWFOptionForm exportOptionsForm = new ExportDWFOptionForm(exportDWFData))
                {
                    exportOptionsForm.ShowDialog();
                }
            }
        }