public UnitStyleFormat() { this.linearDecimalPlaces = 2; this.angularDecimalPlaces = 0; this.decimalSeparator = "."; this.feetInchesSeparator = "-"; this.degreesSymbol = "°"; this.minutesSymbol = "\'"; this.secondsSymbol = "\""; this.radiansSymbol = "r"; this.gradiansSymbol = "g"; this.feetSymbol = "\'"; this.inchesSymbol = "\""; this.fractionType = FractionFormatType.Horizontal; this.supressLinearLeadingZeros = false; this.supressLinearTrailingZeros = false; this.supressAngularLeadingZeros = false; this.supressAngularTrailingZeros = false; this.supressZeroFeet = true; this.supressZeroInches = true; }
/// <summary> /// Formats a text string to represent a fraction. /// </summary> /// <param name="numerator">Fraction numerator.</param> /// <param name="denominator">Fraction denominator.</param> /// <param name="fractionType">Style of the fraction.</param> /// <param name="options">Text formatting options.</param> /// <returns>A text string that represents the fraction.</returns> /// <remarks> /// In fractions the characters '/' and '#' are reserved if you need to write them you must write "\/" and "\#", respectively.<br /> /// Do not combine fractions with super or subscript options, it is not supported (stacking commands cannot be nested). /// </remarks> public void WriteFraction(string numerator, string denominator, FractionFormatType fractionType, MTextFormattingOptions options) { string txt = string.Empty; switch (fractionType) { case FractionFormatType.Diagonal: txt = "\\S" + numerator + "#" + denominator + ";"; break; case FractionFormatType.Horizontal: txt = "\\S" + numerator + "/" + denominator + ";"; break; case FractionFormatType.NotStacked: txt = numerator + "/" + denominator; break; } this.Write(txt, options); }
/// <summary> /// Initializes a new instance of the <c>UnitStyleFormat</c> class. /// </summary> public UnitStyleFormat() { linearDecimalPlaces = 2; angularDecimalPlaces = 0; decimalSeparator = "."; feetInchesSeparator = "-"; degreesSymbol = "°"; minutesSymbol = "\'"; secondsSymbol = "\""; radiansSymbol = "r"; gradiansSymbol = "g"; feetSymbol = "\'"; inchesSymbol = "\""; fractionHeigthScale = 1.0; fractionType = FractionFormatType.Horizontal; supressLinearLeadingZeros = false; supressLinearTrailingZeros = false; supressAngularLeadingZeros = false; supressAngularTrailingZeros = false; supressZeroFeet = true; supressZeroInches = true; }
internal DimensionStyle(string name, bool checkName) : base(name, DxfObjectCode.DimStyle, checkName) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name", "The dimension style name should be at least one character long."); } this.IsReserved = name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase); // dimension and extension lines this.dimclrd = AciColor.ByBlock; this.dimltype = Linetype.ByBlock; this.dimlwd = Lineweight.ByBlock; this.dimdle = 0.0; this.dimdli = 0.38; this.dimsd1 = false; this.dimsd2 = false; this.dimclre = AciColor.ByBlock; this.dimltex1 = Linetype.ByBlock; this.dimltex2 = Linetype.ByBlock; this.dimlwe = Lineweight.ByBlock; this.dimse1 = false; this.dimse2 = false; this.dimexo = 0.0625; this.dimexe = 0.18; this.dimfxlon = false; this.dimfxl = 1.0; // symbols and arrows this.dimldrblk = null; this.dimblk1 = null; this.dimblk2 = null; this.dimasz = 0.18; this.dimcen = 0.09; // text this.dimtxsty = TextStyle.Default; this.dimclrt = AciColor.ByBlock; this.dimtfillclr = null; this.dimtxt = 0.18; this.dimtad = DimensionStyleTextVerticalPlacement.Centered; this.dimjust = DimensionStyleTextHorizontalPlacement.Centered; this.dimgap = 0.09; this.dimtih = false; this.dimtoh = false; this.dimtxtdirection = DimensionStyleTextDirection.LeftToRight; this.dimtfac = 1.0; // fit this.dimtofl = false; this.dimsoxd = true; this.dimscale = 1.0; this.dimatfit = DimensionStyleFitOptions.BestFit; this.dimtix = false; this.dimtmove = DimensionStyleFitTextMove.BesideDimLine; // primary units this.dimdec = 4; this.dimadec = 0; this.dimPrefix = string.Empty; this.dimSuffix = string.Empty; this.dimdsep = '.'; this.dimlfac = 1.0; this.dimaunit = AngleUnitType.DecimalDegrees; this.dimlunit = LinearUnitType.Decimal; this.dimfrac = FractionFormatType.Horizontal; this.suppressLinearLeadingZeros = false; this.suppressLinearTrailingZeros = false; this.suppressZeroFeet = true; this.suppressZeroInches = true; this.suppressAngularLeadingZeros = false; this.suppressAngularTrailingZeros = false; this.dimrnd = 0.0; // alternate units this.alternateUnits = new DimensionStyleAlternateUnits(); // tolerances this.tolerances = new DimensionStyleTolerances(); }
internal DimensionStyle(string name, bool checkName) : base(name, DxfObjectCode.DimStyle, checkName) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name), "The dimension style name should be at least one character long."); } this.IsReserved = name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase); // dimension lines this.dimclrd = AciColor.ByBlock; this.dimltype = Linetype.ByBlock; this.dimlwd = Lineweight.ByBlock; this.dimsd = false; this.dimdli = 0.38; this.dimdle = 0.0; // extension lines this.dimclre = AciColor.ByBlock; this.dimltex1 = Linetype.ByBlock; this.dimltex2 = Linetype.ByBlock; this.dimlwe = Lineweight.ByBlock; this.dimse1 = false; this.dimse2 = false; this.dimexo = 0.0625; this.dimexe = 0.18; // symbols and arrows this.dimasz = 0.18; this.dimcen = 0.09; this.dimldrblk = null; this.dimblk1 = null; this.dimblk2 = null; // text this.dimtxsty = TextStyle.Default; this.dimclrt = AciColor.ByBlock; this.dimtxt = 0.18; this.dimtad = 1; this.dimjust = 0; this.dimgap = 0.09; // fit this.dimscale = 1.0; // primary units this.dimdec = 2; this.dimadec = 0; this.dimPrefix = string.Empty; this.dimSuffix = string.Empty; this.dimtih = 0; this.dimtoh = 0; this.dimdsep = '.'; this.dimlfac = 1.0; this.dimaunit = AngleUnitType.DecimalDegrees; this.dimlunit = LinearUnitType.Decimal; this.dimfrac = FractionFormatType.Horizontal; this.suppressLinearLeadingZeros = false; this.suppressLinearTrailingZeros = false; this.suppressAngularLeadingZeros = false; this.suppressAngularTrailingZeros = false; this.suppressZeroFeet = true; this.suppressZeroInches = true; this.dimrnd = 0.0; }
/// <summary> /// Formats a text string to represent a fraction. /// </summary> /// <param name="numerator">Fraction numerator.</param> /// <param name="denominator">Fraction denominator.</param> /// <param name="fractionType">Style of the fraction.</param> /// <returns>A text string that represents the fraction.</returns> /// <remarks> /// In fractions the characters '/' and '#' are reserved if you need to write them you must write "\/" and "\#", respectively. /// </remarks> public void WriteFraction(string numerator, string denominator, FractionFormatType fractionType) { this.WriteFraction(numerator, denominator, fractionType, null); }
internal DimensionStyle(string name, bool checkName) : base(name, DxfObjectCode.DimStyle, checkName) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name), "The dimension style name should be at least one character long."); this.reserved = name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase); // dimension lines this.dimclrd = AciColor.ByBlock; this.dimltype = LineType.ByBlock; this.dimlwd = Lineweight.ByBlock; this.dimdli = 0.38; this.dimdle = 0.0; // extension lines this.dimclre = AciColor.ByBlock; this.dimltex1 = LineType.ByBlock; this.dimltex2 = LineType.ByBlock; this.dimlwe = Lineweight.ByBlock; this.dimse1 = false; this.dimse2 = false; this.dimexo = 0.0625; this.dimexe = 0.18; // symbols and arrows this.dimasz = 0.18; this.dimcen = 0.09; this.dimsah = false; this.dimldrblk = null; this.dimblk = null; this.dimblk1 = null; this.dimblk2 = null; // text this.dimtxsty = TextStyle.Default; this.dimclrt = AciColor.ByBlock; this.dimtxt = 0.18; this.dimtad = 1; this.dimjust = 0; this.dimgap = 0.09; // fit this.dimscale = 1.0; // primary units this.dimdec = 2; this.dimadec = 0; this.dimpost = "<>"; this.dimtih = 0; this.dimtoh = 0; this.dimdsep = '.'; this.dimlfac = 1.0; this.dimaunit = AngleUnitType.DecimalDegrees; this.dimlunit = LinearUnitType.Decimal; this.dimfrac = FractionFormatType.Horizontal; this.suppressLinearLeadingZeros = false; this.suppressLinearTrailingZeros = false; this.suppressAngularLeadingZeros = false; this.suppressAngularTrailingZeros = false; this.suppressZeroFeet = true; this.suppressZeroInches = true; this.dimrnd = 0.0; }