Example #1
0
        /// <summary>
        /// Creates a new Layer that is a copy of the current instance.
        /// </summary>
        /// <param name="newName">Layer name of the copy.</param>
        /// <returns>A new Layer that is a copy of this instance.</returns>
        public override TableObject Clone(string newName)
        {
            Layer copy = new Layer(newName)
            {
                Color        = (AciColor)Color.Clone(),
                IsVisible    = isVisible,
                IsFrozen     = isFrozen,
                IsLocked     = isLocked,
                Plot         = plot,
                Linetype     = (Linetype)Linetype.Clone(),
                Lineweight   = Lineweight,
                Transparency = (Transparency)Transparency.Clone()
            };

            foreach (XData data in XData.Values)
            {
                copy.XData.Add((XData)data.Clone());
            }

            return(copy);
        }
Example #2
0
        /// <summary>
        /// Creates a new DimensionStyle that is a copy of the current instance.
        /// </summary>
        /// <param name="newName">DimensionStyle name of the copy.</param>
        /// <returns>A new DimensionStyle that is a copy of this instance.</returns>
        public override TableObject Clone(string newName)
        {
            DimensionStyle copy = new DimensionStyle(newName)
            {
                // dimension lines
                DimLineColor       = (AciColor)dimclrd.Clone(),
                DimLineLinetype    = (Linetype)dimltype.Clone(),
                DimLineLineweight  = dimlwd,
                DimLine1Off        = dimsd1,
                DimLine2Off        = dimsd2,
                DimBaselineSpacing = dimdli,
                DimLineExtend      = dimdle,

                // extension lines
                ExtLineColor      = (AciColor)dimclre.Clone(),
                ExtLine1Linetype  = (Linetype)dimltex1.Clone(),
                ExtLine2Linetype  = (Linetype)dimltex2.Clone(),
                ExtLineLineweight = dimlwe,
                ExtLine1Off       = dimse1,
                ExtLine2Off       = dimse2,
                ExtLineOffset     = dimexo,
                ExtLineExtend     = dimexe,

                // symbols and arrows
                ArrowSize      = dimasz,
                CenterMarkSize = dimcen,
                LeaderArrow    = (Block)dimldrblk?.Clone(),
                DimArrow1      = (Block)dimblk1?.Clone(),
                DimArrow2      = (Block)dimblk2?.Clone(),

                // text appearance
                TextStyle               = (TextStyle)dimtxsty.Clone(),
                TextColor               = (AciColor)dimclrt.Clone(),
                TextFillColor           = (AciColor)dimtfillclr?.Clone(),
                TextHeight              = dimtxt,
                TextHorizontalPlacement = dimjust,
                TextVerticalPlacement   = dimtad,
                TextOffset              = dimgap,
                TextFractionHeightScale = dimtfac,

                // fit
                FitDimLineForce  = dimtofl,
                FitDimLineInside = dimsoxd,
                DimScaleOverall  = dimscale,
                FitOptions       = dimatfit,
                FitTextInside    = dimtix,
                FitTextMove      = dimtmove,

                // primary units
                AngularPrecision             = dimadec,
                LengthPrecision              = dimdec,
                DimPrefix                    = dimPrefix,
                DimSuffix                    = dimSuffix,
                DecimalSeparator             = dimdsep,
                DimScaleLinear               = dimlfac,
                DimLengthUnits               = dimlunit,
                DimAngularUnits              = dimaunit,
                FractionType                 = dimfrac,
                SuppressLinearLeadingZeros   = suppressLinearLeadingZeros,
                SuppressLinearTrailingZeros  = suppressLinearTrailingZeros,
                SuppressZeroFeet             = suppressZeroFeet,
                SuppressZeroInches           = suppressZeroInches,
                SuppressAngularLeadingZeros  = suppressAngularLeadingZeros,
                SuppressAngularTrailingZeros = suppressAngularTrailingZeros,
                DimRoundoff                  = dimrnd,

                // alternate units
                AlternateUnits = (DimensionStyleAlternateUnits)alternateUnits.Clone(),

                // tolerances
                Tolerances = (DimensionStyleTolerances)tolerances.Clone()
            };

            foreach (XData data in XData.Values)
            {
                copy.XData.Add((XData)data.Clone());
            }

            return(copy);
        }