-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #537 from DomCR/issue-534_XData-link-cadDocument
Issue 534 XData link cad document
- Loading branch information
Showing
7 changed files
with
128 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using ACadSharp.Entities; | ||
using ACadSharp.Tables; | ||
using ACadSharp.XData; | ||
using System.Linq; | ||
using Xunit; | ||
|
||
namespace ACadSharp.Tests.XData | ||
{ | ||
public class ExtendedDataTests | ||
{ | ||
[Fact] | ||
public void AddObjectWithXData() | ||
{ | ||
CadDocument doc = new CadDocument(); | ||
|
||
string appName = "my_custom_app"; | ||
AppId app = new AppId(appName); | ||
Line line = new Line(); | ||
ExtendedData extendedData = new ExtendedData(); | ||
ExtendedDataRecord extendedDataRecord = new ExtendedDataString("extended data record"); | ||
extendedData.Records.Add(extendedDataRecord); | ||
|
||
line.ExtendedData.Add(app, extendedData); | ||
|
||
doc.Entities.Add(line); | ||
|
||
Assert.Contains(app, doc.AppIds); | ||
Assert.False(app.Handle == 0); | ||
|
||
Assert.NotEmpty(line.ExtendedData); | ||
Assert.NotEmpty(line.ExtendedData.Get(appName).Records); | ||
Assert.Equal(extendedDataRecord, line.ExtendedData.Get(appName).Records.First()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
using ACadSharp.Tables; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace ACadSharp.XData | ||
{ | ||
public class ExtendedData | ||
{ | ||
public AppId AppId { get; } | ||
public List<ExtendedDataRecord> Records { get; } = new(); | ||
|
||
public List<ExtendedDataRecord> Records { get; } = new List<ExtendedDataRecord>(); | ||
|
||
public ExtendedData(AppId app) | ||
public ExtendedData() | ||
{ | ||
this.AppId = app; | ||
} | ||
|
||
public ExtendedData(AppId app, IEnumerable<ExtendedDataRecord> records) : this(app) | ||
public ExtendedData(IEnumerable<ExtendedDataRecord> records) : this() | ||
{ | ||
this.Records.AddRange(records); | ||
} | ||
|
||
public void AddControlStrings() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters