Exemple #1
0
        private void ConvertSheetSizeToInventorUnits()
        {
            if (this.SelectedSheetSize.Equals("Custom sheet size (inches)"))
            {
                //if(String.IsNullOrEmpty(SheetHeight))
                //    SheetHeight = "8.5";
                //if(String.IsNullOrEmpty(SheetWidth))
                //    SheetWidth = "11";
                double height;
                double width;
                try
                {
                    height = Convert.ToDouble(SheetHeight);
                    width  = Convert.ToDouble(SheetWidth);
                }
                catch (Exception)
                {
                    MessageBox.Show("Invalid input for Height or Width.");
                    throw;
                }

                height = height * 2.54;
                width  = width * 2.54;

                SheetHeight = Convert.ToString(height);
                SheetWidth  = Convert.ToString(width);
            }
            else if (SelectedSheetSize.Equals("Custom sheet size (mm)"))
            {
                //if(String.IsNullOrEmpty(SheetHeight))
                //    SheetHeight = "210";
                //if(String.IsNullOrEmpty(SheetWidth))
                //    SheetWidth = "297";

                double height;
                double width;

                try
                {
                    height = Convert.ToDouble(SheetHeight);
                    width  = Convert.ToDouble(SheetWidth);
                }
                catch (Exception)
                {
                    MessageBox.Show("Invalid input for Height or Width.");
                    throw;
                }

                height = height * 0.1;
                width  = width * 0.1;

                SheetHeight = Convert.ToString(height);
                SheetWidth  = Convert.ToString(width);
            }
        }
Exemple #2
0
 public void CreateNewSheet()
 {
     if (!CurrentSheetFormat.Equals(@"*New Custom Sheet Format*"))
     {
         NewSheetFromSheetFormat();
     }
     else if (!(SelectedSheetSize.Equals("Custom sheet size (inches)") ||
                SelectedSheetSize.Equals("Custom sheet size (mm)")))
     {
         NewSheetWithStandardSize();
     }
     else
     {
         NewSheetWithCustomSize();
     }
 }
Exemple #3
0
        private DrawingSheetSizeEnum GetDrawingSize()
        {
            if (SelectedSheetSize.Equals("Custom sheet size (inches)") ||
                SelectedSheetSize.Equals("Custom sheet size (mm)"))
            {
                ConvertSheetSizeToInventorUnits();
                return(DrawingSheetSizeEnum.kCustomDrawingSheetSize);
            }
            else
            {
                DrawingSheetSizeEnum sheetSizeToReturn;
                switch (SelectedSheetSize)
                {
                case "A size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kADrawingSheetSize;
                    break;

                case "B size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kBDrawingSheetSize;
                    break;

                case "C size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kCDrawingSheetSize;
                    break;

                case "D size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kDDrawingSheetSize;
                    break;

                case "E size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kEDrawingSheetSize;
                    break;

                case "F size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kFDrawingSheetSize;
                    break;

                case "A0 size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kA0DrawingSheetSize;
                    break;

                case "A1 size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kA1DrawingSheetSize;
                    break;

                case "A2 size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kA2DrawingSheetSize;
                    break;

                case "A3 size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kA3DrawingSheetSize;
                    break;

                case "A4 size":
                    sheetSizeToReturn = DrawingSheetSizeEnum.kA4DrawingSheetSize;
                    break;

                default:
                    sheetSizeToReturn = DrawingSheetSizeEnum.kADrawingSheetSize;
                    break;
                }
                return(sheetSizeToReturn);
            }
        }