/// <summary> /// Creates a new MLineStyle that is a copy of the current instance. /// </summary> /// <param name="newName">MLineStyle name of the copy.</param> /// <returns>A new MLineStyle that is a copy of this instance.</returns> public override TableObject Clone(string newName) { List <MLineStyleElement> copyElements = new List <MLineStyleElement>(); foreach (MLineStyleElement e in elements) { copyElements.Add((MLineStyleElement)e.Clone()); } MLineStyle copy = new MLineStyle(newName, copyElements) { Flags = flags, Description = description, FillColor = (AciColor)fillColor.Clone(), StartAngle = startAngle, EndAngle = endAngle, }; foreach (XData data in XData.Values) { copy.XData.Add((XData)data.Clone()); } return(copy); }
private Line CreateLine(Vector2 start, Vector2 end, AciColor color, Linetype linetype) { return(new Line(start, end) { Layer = (Layer)this.Layer.Clone(), Linetype = (Linetype)linetype.Clone(), Color = (AciColor)color.Clone(), Lineweight = this.Lineweight, Transparency = (Transparency)this.Transparency.Clone(), LinetypeScale = this.LinetypeScale, Normal = this.Normal }); }
private Arc CreateArc(Vector2 center, double radius, double startAngle, double endAngle, AciColor color, Linetype linetype) { return(new Arc(center, radius, startAngle, endAngle) { Layer = (Layer)this.Layer.Clone(), Linetype = (Linetype)linetype.Clone(), Color = (AciColor)color.Clone(), Lineweight = this.Lineweight, Transparency = (Transparency)this.Transparency.Clone(), LinetypeScale = this.LinetypeScale, Normal = this.Normal, IsVisible = this.IsVisible, }); }
public override object Clone() { HatchGradientPattern copy = new HatchGradientPattern { // Pattern Fill = Fill, Type = Type, Origin = Origin, Angle = Angle, Scale = Scale, Style = Style, // GraientPattern GradientType = gradientType, Color1 = (AciColor)color1.Clone(), Color2 = (AciColor)color2.Clone(), SingleColor = singleColor, Tint = tint, Centered = centered }; return(copy); }
/// <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); }
/// <summary> /// Decompose the actual polyface mesh faces in <see cref="Point">points</see> (one vertex polyface mesh face), /// <see cref="Line">lines</see> (two vertexes polyface mesh face) and <see cref="Face3D">3d faces</see> (three or four vertexes polyface mesh face). /// </summary> /// <returns>A list of <see cref="Face3D">3d faces</see> that made up the polyface mesh.</returns> public List <EntityObject> Explode() { List <EntityObject> entities = new List <EntityObject>(); foreach (PolyfaceMeshFace face in this.faces) { AciColor faceColor = face.Color == null ? this.Color : face.Color; Layer faceLayer = face.Layer == null ? this.Layer : face.Layer; if (face.VertexIndexes.Length == 1) { Point point = new Point { Layer = (Layer)faceLayer.Clone(), Linetype = (Linetype)this.Linetype.Clone(), Color = (AciColor)faceColor.Clone(), Lineweight = this.Lineweight, Transparency = (Transparency)this.Transparency.Clone(), LinetypeScale = this.LinetypeScale, Normal = this.Normal, Position = this.Vertexes[Math.Abs(face.VertexIndexes[0]) - 1], }; entities.Add(point); continue; } if (face.VertexIndexes.Length == 2) { Line line = new Line { Layer = (Layer)faceLayer.Clone(), Linetype = (Linetype)this.Linetype.Clone(), Color = (AciColor)faceColor.Clone(), Lineweight = this.Lineweight, Transparency = (Transparency)this.Transparency.Clone(), LinetypeScale = this.LinetypeScale, Normal = this.Normal, StartPoint = this.Vertexes[Math.Abs(face.VertexIndexes[0]) - 1], EndPoint = this.Vertexes[Math.Abs(face.VertexIndexes[1]) - 1], }; entities.Add(line); continue; } Face3DEdgeFlags edgeVisibility = Face3DEdgeFlags.None; short indexV1 = face.VertexIndexes[0]; short indexV2 = face.VertexIndexes[1]; short indexV3 = face.VertexIndexes[2]; // Polyface mesh faces are made of 3 or 4 vertexes, we will repeat the third vertex if the number of face vertexes is three int indexV4 = face.VertexIndexes.Length == 3 ? face.VertexIndexes[2] : face.VertexIndexes[3]; if (indexV1 < 0) { edgeVisibility |= Face3DEdgeFlags.First; } if (indexV2 < 0) { edgeVisibility |= Face3DEdgeFlags.Second; } if (indexV3 < 0) { edgeVisibility |= Face3DEdgeFlags.Third; } if (indexV4 < 0) { edgeVisibility |= Face3DEdgeFlags.Fourth; } Vector3 v1 = this.Vertexes[Math.Abs(indexV1) - 1]; Vector3 v2 = this.Vertexes[Math.Abs(indexV2) - 1]; Vector3 v3 = this.Vertexes[Math.Abs(indexV3) - 1]; Vector3 v4 = this.Vertexes[Math.Abs(indexV4) - 1]; Face3D face3D = new Face3D { Layer = (Layer)faceLayer.Clone(), Linetype = (Linetype)this.Linetype.Clone(), Color = (AciColor)faceColor.Clone(), Lineweight = this.Lineweight, Transparency = (Transparency)this.Transparency.Clone(), LinetypeScale = this.LinetypeScale, Normal = this.Normal, FirstVertex = v1, SecondVertex = v2, ThirdVertex = v3, FourthVertex = v4, EdgeFlags = edgeVisibility, }; entities.Add(face3D); } return(entities); }