Exemplo n.º 1
0
 private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 2)
     {
         // show UI
         Autodesk.Revit.DB.UnitType unittype = (Autodesk.Revit.DB.UnitType) this.dataGridView["UnitType", e.RowIndex].Value;
         using (FormatForm displayForm = new FormatForm(unittype, m_units.GetFormatOptions(unittype)))
         {
             DialogResult result;
             while (DialogResult.Cancel != (result = displayForm.ShowDialog()))
             {
                 if (DialogResult.OK == result)
                 {
                     try
                     {
                         this.m_units.SetFormatOptions((Autodesk.Revit.DB.UnitType) this.dataGridView["UnitType", e.RowIndex].Value, displayForm.FormatOptions);
                         this.dataGridView["FormatOptions", e.RowIndex].Value =
                             Autodesk.Revit.DB.UnitFormatUtils.Format(m_units, (Autodesk.Revit.DB.UnitType) this.dataGridView["UnitType", e.RowIndex].Value, 1234.56789, false, false);
                         break;
                     }
                     catch (System.Exception ex)
                     {
                         TaskDialog.Show(ex.GetType().ToString(), "Set FormatOptions error : \n" + ex.Message, TaskDialogCommonButtons.Ok);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initialize GUI with FormatData
 /// </summary>
 ///// <param name="dataBuffer">relevant data from revit</param>
 public FormatForm(Autodesk.Revit.DB.UnitType unittype, Autodesk.Revit.DB.FormatOptions formatoptions)
 {
     InitializeComponent();
     m_unittype                            = unittype;
     m_formatoptions                       = new Autodesk.Revit.DB.FormatOptions(formatoptions.DisplayUnits, formatoptions.UnitSymbol);
     m_formatoptions.UseDefault            = formatoptions.UseDefault;
     m_formatoptions.Accuracy              = formatoptions.Accuracy;
     m_formatoptions.SuppressTrailingZeros = formatoptions.SuppressTrailingZeros;
     m_formatoptions.SuppressLeadingZeros  = formatoptions.SuppressLeadingZeros;
     m_formatoptions.UsePlusPrefix         = formatoptions.UsePlusPrefix;
     m_formatoptions.UseDigitGrouping      = formatoptions.UseDigitGrouping;
     m_formatoptions.SuppressSpaces        = formatoptions.SuppressSpaces;
 }
Exemplo n.º 3
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     Autodesk.Revit.DB.UnitType type = (Autodesk.Revit.DB.UnitType)value;
     return(type.ToString());
 }