/// <summary> /// Creates a new XLine that is a copy of the current instance. /// </summary> /// <returns>A new XLine that is a copy of this instance.</returns> public override object Clone() { XLine entity = new XLine { //EntityObject properties Layer = (Layer)this.Layer.Clone(), Linetype = (Linetype)this.Linetype.Clone(), Color = (AciColor)this.Color.Clone(), Lineweight = this.Lineweight, Transparency = (Transparency)this.Transparency.Clone(), LinetypeScale = this.LinetypeScale, Normal = this.Normal, IsVisible = this.IsVisible, //XLine properties Origin = this.origin, Direction = this.direction, }; foreach (XData data in this.XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new XLine that is a copy of the current instance. /// </summary> /// <returns>A new XLine that is a copy of this instance.</returns> public override object Clone() { XLine entity = new XLine { //EntityObject properties Layer = (Layer)this.layer.Clone(), LineType = (LineType)this.lineType.Clone(), Color = (AciColor) this.color.Clone(), Lineweight = (Lineweight) this.lineweight.Clone(), Transparency = (Transparency) this.transparency.Clone(), LineTypeScale = this.lineTypeScale, Normal = this.normal, //XLine properties Origin = this.origin, Direction = this.direction, }; foreach (XData data in this.XData.Values) entity.XData.Add((XData)data.Clone()); return entity; }
private XLine ReadXLine() { Vector3 origin = Vector3.Zero; Vector3 direction = Vector3.UnitX; List<XData> xData = new List<XData>(); this.chunk.Next(); while (this.chunk.Code != 0) { switch (this.chunk.Code) { case 10: origin.X = this.chunk.ReadDouble(); this.chunk.Next(); break; case 20: origin.Y = this.chunk.ReadDouble(); this.chunk.Next(); break; case 30: origin.Z = this.chunk.ReadDouble(); this.chunk.Next(); break; case 11: direction.X = this.chunk.ReadDouble(); this.chunk.Next(); break; case 21: direction.Y = this.chunk.ReadDouble(); this.chunk.Next(); break; case 31: direction.Z = this.chunk.ReadDouble(); this.chunk.Next(); break; case 1001: string appId = this.DecodeEncodedNonAsciiCharacters(this.chunk.ReadString()); XData data = this.ReadXDataRecord(this.GetApplicationRegistry(appId)); xData.Add(data); break; default: if (this.chunk.Code >= 1000 && this.chunk.Code <= 1071) throw new Exception("The extended data of an entity must start with the application registry code."); this.chunk.Next(); break; } } XLine entity = new XLine { Origin = origin, Direction = direction }; entity.XData.AddRange(xData); return entity; }
private void WriteXLine(XLine xline) { this.chunk.Write(100, SubclassMarker.XLine); this.chunk.Write(10, xline.Origin.X); this.chunk.Write(20, xline.Origin.Y); this.chunk.Write(30, xline.Origin.Z); this.chunk.Write(11, xline.Direction.X); this.chunk.Write(21, xline.Direction.Y); this.chunk.Write(31, xline.Direction.Z); this.WriteXData(xline.XData); }
private static void RayAndXLine() { Ray ray = new Ray(new Vector3(1, 1, 1), new Vector3(1, 1, 1)); XLine xline = new XLine(Vector2.Zero, new Vector2(1,1)); DxfDocument dxf = new DxfDocument(); dxf.AddEntity(ray); dxf.AddEntity(xline); dxf.Save("RayAndXLine.dxf"); dxf = DxfDocument.Load("RayAndXLine.dxf"); }