diff --git a/README.md b/README.md index 0d014112..b834ec01 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # netDxf -netDxf 2.4.0 Copyright(C) 2009-2020 Daniel Carvajal, Licensed under LGPL +netDxf 2.4.1 Copyright(C) 2009-2020 Daniel Carvajal, Licensed under LGPL ## Description netDxf is a .net library programmed in C# to read and write AutoCAD DXF files. It supports AutoCad2000, AutoCad2004, AutoCad2007, AutoCad2010, AutoCad2013, and AutoCad2018 DXF database versions, in both text and binary format. diff --git a/doc/Changelog.txt b/doc/Changelog.txt index 6fc144d7..8f3ce550 100644 --- a/doc/Changelog.txt +++ b/doc/Changelog.txt @@ -1,28 +1,21 @@ ## Change history -### [2020/11/16] +### [2.4.1 - 2020/12/06] +* Added LayerStates accessible trough the Layers.StateManager. For more details see LayerStateManager() sample. +* Added some workarounds for invalid values in buggy DXF files. +* Renamed AttributeFlags.Visible to AttributeFlags.None. +* Renamed Face3dEdgeFlags.Visibles to AttributeFlags.None. * The AttributeDefiniton and Attribute Value property are now stored as strings. The user will be responsible on how to convert this value to and from the string. In the end this value is always stored in a DXF file as a string (code 1), and how the conversion is done from a generic object value may differ from user to user. - -### [2020/11/14] * Now it is possible to change the ImageDefinition of an Image entity. * Now it is possible to change the UnderlayDefinition of an Underlay entity. * Now it is possible to change the ShapeStyle and Name of a Shape entity. You will need to make sure that the actual shape style file has a shape with the actual name. There are a few methods to help you with that in the ShapeStyle class but they only work with the SHP shape files. * (fixed) Error creating the Underlay definition dictionaries when multiple entries of the same type PDF, DWF, or DGN where present. - -### [2020/11/09] -* Added some workarounds for invalid values in buggy DXF files. -* (fixed) In the ACAD_DICTIONARY info, for the Layer table, a "{" was written instead of "}". - - -### [2020/08/20] -* Added LayerStates accessible trough the Layers.StateManager. For more details see LayerStateManager() sample. -* Renamed AttributeFlags.Visible to AttributeFlags.None. -* Renamed Face3dEdgeFlags.Visibles to AttributeFlags.None. +* (fixed) Linetypes that contain complex segments were not being added to corresponding reference list of the TextSyle or ShapeStyle. * (fixed) The layer transparency was not being written correctly to the DXF. * (fixed) Blocks associated to paper space layouts can contain attribute definitions, although its use is uncommon there is no reason they cannot have them. * (fixed) Issue with DXFs with multiple Model viewports (VPorts) that contain extended data information. diff --git a/doc/netDxf Documentation.chm b/doc/netDxf Documentation.chm index 68e86467..d56192b1 100644 Binary files a/doc/netDxf Documentation.chm and b/doc/netDxf Documentation.chm differ diff --git a/netDxf/Collections/AttributeDefinitionDictionary.cs b/netDxf/Collections/AttributeDefinitionDictionary.cs index 090beac8..7e024d3d 100644 --- a/netDxf/Collections/AttributeDefinitionDictionary.cs +++ b/netDxf/Collections/AttributeDefinitionDictionary.cs @@ -136,7 +136,7 @@ public AttributeDefinition this[string tag] throw new ArgumentException(string.Format("The dictionary tag: {0}, and the attribute definition tag: {1}, must be the same", tag, value.Tag)); // there is no need to add the same object, it might cause overflow issues - if (ReferenceEquals(this.innerDictionary[tag].Value, value)) + if (ReferenceEquals(this.innerDictionary[tag], value)) return; AttributeDefinition remove = this.innerDictionary[tag]; diff --git a/netDxf/Collections/Linetypes.cs b/netDxf/Collections/Linetypes.cs index a09e0c2a..4ef5f8bd 100644 --- a/netDxf/Collections/Linetypes.cs +++ b/netDxf/Collections/Linetypes.cs @@ -233,6 +233,10 @@ public override bool Remove(Linetype item) if (this.references[item.Name].Count != 0) return false; + LinetypeSegment[] segments = new LinetypeSegment[item.Segments.Count]; + item.Segments.CopyTo(segments, 0); + item.Segments.Remove(segments); + this.Owner.AddedObjects.Remove(item.Handle); this.references.Remove(item.Name); this.list.Remove(item.Name); @@ -268,13 +272,13 @@ private void Linetype_SegmentAdded(Linetype sender, LinetypeSegmentChangeEventAr { LinetypeTextSegment textSegment = (LinetypeTextSegment)e.Item; textSegment.Style = this.Owner.TextStyles.Add(textSegment.Style); - //this.Owner.TextStyles.References[textSegment.Style.Name].Add(sender); + this.Owner.TextStyles.References[textSegment.Style.Name].Add(sender); } if (e.Item.Type == LinetypeSegmentType.Shape) { LinetypeShapeSegment shapeSegment = (LinetypeShapeSegment)e.Item; shapeSegment.Style = this.Owner.ShapeStyles.Add(shapeSegment.Style); - //this.Owner.ShapeStyles.References[shapeSegment.Name].Add(sender); + this.Owner.ShapeStyles.References[shapeSegment.Name].Add(sender); } } diff --git a/netDxf/Entities/Attribute.cs b/netDxf/Entities/Attribute.cs index 5844aaec..b4442d9f 100644 --- a/netDxf/Entities/Attribute.cs +++ b/netDxf/Entities/Attribute.cs @@ -27,7 +27,7 @@ namespace netDxf.Entities { /// - /// Represents a attribute entity. + /// Represents a attribute. /// /// /// The attribute position, rotation, height and width factor values also includes the transformation of the Insert entity to which it belongs.
@@ -702,6 +702,11 @@ public object Clone() IsUpsideDown = this.isUpsideDown }; + foreach (XData data in this.XData.Values) + { + entity.XData.Add((XData) data.Clone()); + } + return entity; } diff --git a/netDxf/Entities/AttributeDefinition.cs b/netDxf/Entities/AttributeDefinition.cs index 5f45f60c..380e7880 100644 --- a/netDxf/Entities/AttributeDefinition.cs +++ b/netDxf/Entities/AttributeDefinition.cs @@ -28,7 +28,7 @@ namespace netDxf.Entities { /// - /// Represents an attribute definition entity. + /// Represents an attribute definition. /// /// /// AutoCad allows to have duplicate tags in the attribute definitions list, but this library does not. @@ -716,6 +716,5 @@ public object Clone() } #endregion - } } diff --git a/netDxf/Tables/Linetype.cs b/netDxf/Tables/Linetype.cs index 6a40f009..8c2b3ac0 100644 --- a/netDxf/Tables/Linetype.cs +++ b/netDxf/Tables/Linetype.cs @@ -229,6 +229,7 @@ public Linetype(string name, string description) /// Initializes a new instance of the Linetype class. /// /// Line type name. + /// List of linetype segments. public Linetype(string name, IEnumerable segments) : this(name, segments, string.Empty, true) { @@ -238,6 +239,7 @@ public Linetype(string name, IEnumerable segments) /// Initializes a new instance of the Linetype class. /// /// Line type name. + /// List of linetype segments. /// Line type description. public Linetype(string name, IEnumerable segments, string description) : this(name, segments, description, true)