Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 458 hatch clone fix #469

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading