Skip to content

Commit

Permalink
xrecord
Browse files Browse the repository at this point in the history
  • Loading branch information
DomCR committed Jul 3, 2023
1 parent 522f558 commit eabf67b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
31 changes: 29 additions & 2 deletions ACadSharp/IO/DXF/DxfStreamReader/DxfObjectsSectionReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ private CadTemplate readObject()
case DxfFileToken.ObjectSortEntsTable:
return this.readSortentsTable();
case DxfFileToken.ObjectXRecord:
template = new CadXRecordTemplate(new XRecrod());
break;
return this.readObjectCodes<XRecrod>(new CadXRecordTemplate(), readXRecord);
default:
this._builder.Notify($"Object not implemented: {this._reader.ValueAsString}", NotificationType.NotImplemented);
do
Expand Down Expand Up @@ -159,6 +158,34 @@ private bool readLayout(CadTemplate template, DxfMap map)
}
}

private bool readXRecord(CadTemplate template, DxfMap map)
{
CadXRecordTemplate tmp = template as CadXRecordTemplate;

//TODO: Finsih cadXrecordtemplate

switch (this._reader.Code)
{
case 100 when this._reader.ValueAsString == DxfSubclassMarker.XRecord:
this.readXRecordEntries(tmp.CadObject);
return true;
default:
return this.tryAssignCurrentValue(template.CadObject, map.SubClasses[DxfSubclassMarker.XRecord]);
}
}

private void readXRecordEntries(XRecrod recrod)
{
this._reader.ReadNext();

while (this._reader.DxfCode != DxfCode.Start)
{
recrod.Entries.Add(new XRecrod.Entry(this._reader.Code, this._reader.Value));

this._reader.ReadNext();
}
}

private CadTemplate readDictionary()
{
CadDictionary cadDictionary = new CadDictionary();
Expand Down
2 changes: 2 additions & 0 deletions ACadSharp/IO/Templates/CadXRecordTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ namespace ACadSharp.IO.Templates
{
internal class CadXRecordTemplate : CadTemplate<XRecrod>
{
public CadXRecordTemplate() : base(new XRecrod()) { }

public CadXRecordTemplate(XRecrod cadObject) : base(cadObject) { }

public override bool CheckDxfCode(int dxfcode, object value)
Expand Down

0 comments on commit eabf67b

Please sign in to comment.