Ejemplo n.º 1
0
        /// <summary>
        /// Sets the dialog result when clicking the Cancel button.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void buttonCancel_Click(object sender, RoutedEventArgs args)
        {
            Result = IFCExportResult.Cancel;
            IFCExportConfiguration selectedConfig = GetSelectedConfiguration();

            LastSelectedConfig[selectedConfig.Name] = selectedConfig;
            Close();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Exports as an IFC file on clicking OK.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void buttonNext_Click(object sender, RoutedEventArgs args)
        {
            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(textBoxSetupFileName.Text);
            string filePath = Path.GetDirectoryName(textBoxSetupFileName.Text);

            // Show Path is invalid message if the path is blank or invalid.
            if (!string.IsNullOrWhiteSpace(filePath) && !Directory.Exists(filePath))
            {
                TaskDialog.Show("Error", Properties.Resources.ValidPathExists);
            }
            else
            {
                // Create a default .ifc file if the file name is blank
                if (String.IsNullOrWhiteSpace(filePath))
                {
                    updateFileName();
                }

                // Check for a valid IFC File format, if it does not exists, append the default IFC file format to export to the file
                if (Path.GetExtension(textBoxSetupFileName.Text).IndexOf(Properties.Resources.IFC, StringComparison.CurrentCultureIgnoreCase) == -1)
                {
                    textBoxSetupFileName.Text = textBoxSetupFileName.Text.ToString() + "." + m_defaultExt;
                }

                // Prompt for overwriting the file if it is already present in the directory.
                if (File.Exists(textBoxSetupFileName.Text))
                {
                    TaskDialogResult msgBoxResult = TaskDialog.Show(Properties.Resources.IFCExport, String.Format(Properties.Resources.FileExists, textBoxSetupFileName.Text), TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No);
                    if (msgBoxResult == TaskDialogResult.No)
                    {
                        return;
                    }
                }
                Result = IFCExportResult.ExportAndSaveSettings;
                Close();

                TheDocument.Application.WriteJournalComment("Dialog Closed", true);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets the dialog result when clicking the Next button.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void buttonNext_Click(object sender, RoutedEventArgs args)
        {
            List <CheckBox> cbList = this.listViewDocuments.Items.Cast <CheckBox>().ToList();

            int count = 0;

            foreach (CheckBox cb in cbList)
            {
                if ((bool)cb.IsChecked)
                {
                    DocumentsToExport.Add(OrderedDocuments[count]);
                }
                count++;
            }

            if (DocumentsToExport.Count == 0)
            {
                MessageBox.Show(Properties.Resources.SelectOneOrMoreProjects, Properties.Resources.IFCExport, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            Result = IFCExportResult.ExportAndSaveSettings;
            Close();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the dialog result when clicking the Cancel button.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">Event arguments that contains the event data.</param>
 private void buttonCancel_Click(object sender, RoutedEventArgs args)
 {
     m_result = IFCExportResult.Cancel;
     Close();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the dialog result when clicking the Next button.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">Event arguments that contains the event data.</param>
 private void buttonNext_Click(object sender, RoutedEventArgs args)
 {
     m_result = IFCExportResult.ExportAndSaveSettings;
     Close();
 }
 /// <summary>
 /// Sets the dialog result when clicking the Cancel button.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">Event arguments that contains the event data.</param>
 private void buttonCancel_Click(object sender, RoutedEventArgs args)
 {
     m_result = IFCExportResult.Cancel;
     Close();
 }
 /// <summary>
 /// Sets the dialog result when clicking the Next button.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">Event arguments that contains the event data.</param>
 private void buttonNext_Click(object sender, RoutedEventArgs args)
 {
     m_result = IFCExportResult.ExportAndSaveSettings;
     Close();
 }
        /// <summary>
        /// Sets the dialog result when clicking the Next button.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void buttonNext_Click(object sender, RoutedEventArgs args)
        {
           List<CheckBox> cbList = this.listViewDocuments.Items.Cast<CheckBox>().ToList();

           int count = 0;
           foreach (CheckBox cb in cbList)
           {
              if ((bool)cb.IsChecked)
                 DocumentsToExport.Add(OrderedDocuments[count]);
              count++;
           }

           if (DocumentsToExport.Count == 0)
           {
              MessageBox.Show(Properties.Resources.SelectOneOrMoreProjects, Properties.Resources.IFCExport, MessageBoxButton.OK, MessageBoxImage.Error);
              return;
           }
           Result = IFCExportResult.ExportAndSaveSettings;
            Close();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Exports as an IFC file on clicking OK.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void buttonNext_Click(object sender, RoutedEventArgs args)
        {
            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(textBoxSetupFileName.Text);
            string filePath = Path.GetDirectoryName(textBoxSetupFileName.Text);

            // Show Path is invalid message if the path is blank or invalid.
            if (!string.IsNullOrWhiteSpace(filePath) && !Directory.Exists(filePath))
            {
                TaskDialog.Show("Error", Properties.Resources.ValidPathExists);
            }
            else
            {
                // Create a default .ifc file if the file name is blank
                if (String.IsNullOrWhiteSpace(filePath))
                {
                    updateFileName();
                }

                // Check for a valid IFC File format, if it does not exists, append the default IFC file format to export to the file
                if (Path.GetExtension(textBoxSetupFileName.Text).IndexOf(Properties.Resources.IFC, StringComparison.CurrentCultureIgnoreCase) == -1)
                {
                    textBoxSetupFileName.Text = textBoxSetupFileName.Text.ToString() + "." + m_defaultExt;
                }

                // Prompt for overwriting the file if it is already present in the directory.
                if (File.Exists(textBoxSetupFileName.Text))
                {
                    TaskDialogResult msgBoxResult = TaskDialog.Show(Properties.Resources.IFCExport, String.Format(Properties.Resources.FileExists, textBoxSetupFileName.Text), TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No);
                    if (msgBoxResult == TaskDialogResult.No)
                    {
                        return;
                    }
                }
                if (Win32API.RtlIsDosDeviceName_U(textBoxSetupFileName.Text) != 0)
                {
                    TaskDialog.Show(Properties.Resources.IFCExport, String.Format(Properties.Resources.ReservedDeviceName, textBoxSetupFileName.Text));
                    return;
                }

                IFCExportConfiguration selectedConfig = GetSelectedConfiguration();
                if (!EditConfigVisited && LastSelectedConfig.ContainsKey(selectedConfig.Name))
                {
                    selectedConfig = LastSelectedConfig[selectedConfig.Name];
                }

                // This check will be done only for IFC4 and above as this only affects IfcMapConversion use that starts in IFC4 onward
                if (!OptionsUtil.ExportAsOlderThanIFC4(selectedConfig.IFCVersion))
                {
                    // Check whether the resulting offset (to wcs) will be too large due to geo-reference information, raise warning
                    BasePoint surveyPoint      = BasePoint.GetSurveyPoint(TheDocument);
                    BasePoint projectBasePoint = BasePoint.GetProjectBasePoint(TheDocument);
                    {
                        XYZ deltaOffset = XYZ.Zero;
                        switch (selectedConfig.SitePlacement)
                        {
                        case SiteTransformBasis.Internal:
                            deltaOffset = projectBasePoint.Position;
                            break;

                        case SiteTransformBasis.Project:
                            // Offset from Project point is Zero, unchanged from the initial value
                            break;

                        case SiteTransformBasis.Site:
                            deltaOffset = projectBasePoint.Position - surveyPoint.Position;
                            break;

                        case SiteTransformBasis.Shared:
                            deltaOffset = projectBasePoint.SharedPosition;
                            break;

                        default:
                            break;
                        }

                        if (!XYZ.IsWithinLengthLimits(deltaOffset))
                        {
                            TaskDialogResult msgBoxResult = TaskDialog.Show(Properties.Resources.IFCExport, Properties.Resources.OffsetDistanceTooLarge,
                                                                            TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel);
                            if (msgBoxResult == TaskDialogResult.Cancel)
                            {
                                return;
                            }
                        }
                    }
                }

                Result = IFCExportResult.ExportAndSaveSettings;
                Close();

                // Set IFC File header with the selected exchange requirement
                if (selectedConfig.ExchangeRequirement != KnownERNames.NotDefined)
                {
                    IFCFileHeader     ifcFileHeader = new IFCFileHeader();
                    IFCFileHeaderItem fileHeaderItem;
                    if (!ifcFileHeader.GetSavedFileHeader(IFCCommandOverrideApplication.TheDocument, out fileHeaderItem))
                    {
                        // Do minimum initialization if the header item is not initialized
                        fileHeaderItem = new IFCFileHeaderItem(IFCCommandOverrideApplication.TheDocument);
                    }

                    string erName = selectedConfig.ExchangeRequirement.ToString();
                    fileHeaderItem.FileDescription = "ExchangeRequirement [" + erName + "]";
                    ifcFileHeader.UpdateFileHeader(IFCCommandOverrideApplication.TheDocument, fileHeaderItem);
                }

                LastSelectedConfig[selectedConfig.Name] = selectedConfig;
                TheDocument.Application.WriteJournalComment("Dialog Closed", true);
            }
        }