Skip to content

Commit

Permalink
Merge pull request #469 from DomCR/issue-458_hatch-document-move
Browse files Browse the repository at this point in the history
Issue 458 hatch clone fix
  • Loading branch information
DomCR authored Oct 4, 2024
2 parents d2e0092 + 7175a3f commit 9e90b13
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/ACadSharp.Tests/IO/LocalSampleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public void ReadUserDwg(FileModel test)
return;

CadDocument doc = DwgReader.Read(test.Path, this._dwgConfiguration, this.onNotification);

CadDocument newDoc = new CadDocument();

foreach (var entity in doc.Entities)
{
doc.Entities.Remove(entity);
newDoc.Entities.Add(entity);
}
}

[Theory]
Expand Down
2 changes: 1 addition & 1 deletion src/ACadSharp/Entities/Hatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public override CadObject Clone()
clone.GradientColor = this.GradientColor?.Clone();
clone.Pattern = this.Pattern?.Clone();

clone.Paths.Clear();
clone.Paths = new List<BoundaryPath>();
foreach (BoundaryPath item in this.Paths)
{
clone.Paths.Add(item.Clone());
Expand Down
2 changes: 1 addition & 1 deletion src/ACadSharp/Entities/HatchPattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public HatchPattern Clone()
{
HatchPattern clone = (HatchPattern)this.MemberwiseClone();

clone.Lines.Clear();
clone.Lines = new List<Line>();
foreach (var item in this.Lines)
{
clone.Lines.Add(item.Clone());
Expand Down

0 comments on commit 9e90b13

Please sign in to comment.