Beispiel #1
0
        private void InitTableData()
        {
            md       = (ModelDoc2)DrawingPropertySet.SwApp.ActiveDoc;
            mde      = md.Extension;
            fracdisp = mde.GetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay,
                                                    (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);
            //int den = mde.GetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearFractionDenominator,
            //  (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);
            decs = mde.GetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalPlaces,
                                                (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);
            decd = mde.GetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay,
                                                (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);

            try {
                mde.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay,
                                             (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, (int)swFractionDisplay_e.swDECIMAL);
                mde.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalPlaces,
                                             (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, 3);
                mde.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay,
                                             (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, 3);
                md.ForceRebuild3(false);

                table = new swTableType.swTableType((DrawingPropertySet.SwApp.ActiveDoc as ModelDoc2),
                                                    Redbrick.MasterHashes);
            } catch (NullReferenceException nre) {
                if (_swApp != null)
                {
                    if (dept > -1)
                    {
                        Redbrick.InsertBOM(_swApp, dept);
                    }
                    else
                    {
                        Redbrick.InsertBOM(_swApp);
                    }
                    InitTableData();
                }
                else
                {
                    throw new NullReferenceException(@"No table found.");
                }
            } catch (Exception e) {
                RedbrickErr.ErrMsg em = new RedbrickErr.ErrMsg(e);
                em.ShowDialog();
                Close();
            } finally {
                //
            }
        }
        private void InitTableData()
        {
            md = (ModelDoc2)DrawingPropertySet.SwApp.ActiveDoc;
              mde = md.Extension;
              fracdisp = mde.GetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay,
            (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);
              //int den = mde.GetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearFractionDenominator,
              //  (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);
              decs = mde.GetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalPlaces,
            (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);
              decd = mde.GetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay,
            (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);

              try {
            mde.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay,
              (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, (int)swFractionDisplay_e.swDECIMAL);
            mde.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalPlaces,
              (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, 3);
            mde.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay,
              (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, 3);
            md.ForceRebuild3(false);

            table = new swTableType.swTableType((DrawingPropertySet.SwApp.ActiveDoc as ModelDoc2),
              Redbrick.MasterHashes);
              } catch (NullReferenceException nre) {
            if (_swApp != null) {
              Redbrick.InsertBOM(_swApp);
              InitTableData();
            } else {
              throw new NullReferenceException(@"No table found.");
            }
              } catch (Exception e) {
            RedbrickErr.ErrMsg em = new RedbrickErr.ErrMsg(e);
            em.ShowDialog();
            Close();
              } finally {
            //
              }
        }