Skip to content

Commit

Permalink
Merge pull request #449 from DomCR/issue-447_enable-dwgwriter-for-att…
Browse files Browse the repository at this point in the history
…ribute-entities

Issue 447 enable dwgwriter for attribute entities
  • Loading branch information
DomCR authored Sep 10, 2024
2 parents 4fd065a + efc3227 commit af4286f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
34 changes: 34 additions & 0 deletions src/ACadSharp.Tests/IO/WriterSingleObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,39 @@ public void ChangedEncoding()
this.Document.Layers.Add(new Layer("我的自定义层"));
}

public void AddBlockWithAttributes()
{
BlockRecord record = new("my_block");

record.Entities.Add(new Circle
{
Radius = 10,
Center = XYZ.Zero
});

record.Entities.Add(new AttributeDefinition()
{
InsertPoint = XYZ.Zero,
Prompt = "Name_custom",
Tag = "CIRCLE_NAME",
Value = "Circilla",
HorizontalAlignment = TextHorizontalAlignment.Left,
Height = 18,
AttributeType = AttributeType.SingleLine,
});

this.Document.BlockRecords.Add(record);

var insert = new Insert(record)
{
InsertPoint = new XYZ(0, 0, 0),
XScale = 0.8,
YScale = 0.8,
};

this.Document.Entities.Add(insert);
}

public void Deserialize(IXunitSerializationInfo info)
{
this.Name = info.GetValue<string>(nameof(this.Name));
Expand Down Expand Up @@ -406,6 +439,7 @@ static WriterSingleObjectTests()
Data.Add(new(nameof(SingleCaseGenerator.CreateHatchPolyline)));
Data.Add(new(nameof(SingleCaseGenerator.CreateHatch)));
Data.Add(new(nameof(SingleCaseGenerator.ChangedEncoding)));
Data.Add(new(nameof(SingleCaseGenerator.AddBlockWithAttributes)));
}

protected string getPath(string name, string ext, ACadVersion version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ private void writeEntity(Entity entity)
switch (entity)
{
case UnknownEntity:
case AttributeEntity:
case Solid3D:
case Mesh:
this.notify($"Entity type not implemented {entity.GetType().FullName}", NotificationType.NotImplemented);
Expand Down

0 comments on commit af4286f

Please sign in to comment.