Esempio n. 1
0
        private void SetUnits(UnitStyleType utStyle)
        {
            _utStyle = utStyle;

            if (_utStyle != UnitStyleType.FEET_DEC_IN)
            {
                units = UnitStylesDefault.StandardUnitStyle(DxMeasure._doc, _utStyle);
            }

            UpdatePoints();
        }
        public static bool SetProjUnitsToStd(Document _doc,
                                             UnitStyleType utStyle)
        {
            Units units = StandardUnitStyle(_doc, utStyle);

            if (units == null)
            {
                return(false);
            }

            if (!SetProjUnits(_doc, units))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        private void LoadSettings()
        {
            if (SmUsrSetg.FormMeasurePointsLocation.Equals(new Point(0, 0)))
            {
                CenterToParent();
            }
            else
            {
                this.Location = SmUsrSetg.FormMeasurePointsLocation;
            }

            cbxWpOnOff.Checked = SmUsrSetg.MeasurePointsShowWorkplane;

            _utStyle = SmUsrSetg.DxMeasureUnitStyle;

            ConfigUnitRadioButtons();

            SetUnits(_utStyle);
        }
        internal static Units GetStdUnitStyle(Document _doc, UnitStyleType utStyle)
        {
            FormatOptions fmtOpts = null;

            if (utStyle == UnitStyleType.PROJECT)
            {
                return(_doc.GetUnits());
            }

            switch (utStyle)
            {
            case UnitStyleType.FEET_FRAC_IN:
            {
                fmtOpts = new FormatOptions(DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES,
                                            UnitSymbolType.UST_NONE, (1.0 / 64.0) / 12.0);
                fmtOpts.SuppressSpaces       = true;
                fmtOpts.SuppressLeadingZeros = true;

                break;
            }

            case UnitStyleType.FRAC_IN:
            {
                fmtOpts = new FormatOptions(DisplayUnitType.DUT_FRACTIONAL_INCHES,
                                            UnitSymbolType.UST_NONE, 1.0 / 64.0);
                break;
            }

            case UnitStyleType.DEC_FT:
            {
                fmtOpts = new FormatOptions(DisplayUnitType.DUT_DECIMAL_FEET,
                                            UnitSymbolType.UST_FOOT_SINGLE_QUOTE, 0.001);
                fmtOpts.SuppressTrailingZeros = true;
                break;
            }

            case UnitStyleType.DEC_IN:
            {
                fmtOpts = new FormatOptions(DisplayUnitType.DUT_DECIMAL_INCHES,
                                            UnitSymbolType.UST_INCH_DOUBLE_QUOTE, 0.0001);
                fmtOpts.SuppressTrailingZeros = true;
                break;
            }

            case UnitStyleType.FRACT_FT:
            {
                fmtOpts = new FormatOptions(DisplayUnitType.DUT_FRACTIONAL_INCHES,
                                            UnitSymbolType.UST_NONE, 1.0 / 64.0);
                break;
            }
            }

            if (fmtOpts == null)
            {
                return(null);
            }

            fmtOpts.UseDigitGrouping = true;

            Units units = new Units(UnitSystem.Imperial);

            units.SetFormatOptions(UnitType.UT_Length, fmtOpts);

            return(units);
        }