Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AC1015 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_m
AC1018 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
AC1021 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |
AC1024 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
AC1027 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
AC1027 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
AC1032 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |

Code Example
Expand All @@ -40,7 +40,7 @@ public static void Main()
CadDocument doc = DwgReader.Read(path, onNotification);
}

// Process a notification form the reader
// Process a notification from the reader
private static void onNotification(object sender, NotificationEventArgs e)
{
Console.WriteLine(e.Message);
Expand Down
7 changes: 7 additions & 0 deletions src/ACadSharp.Tests/IO/DXF/DxfWriterSingleObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ public class DxfWriterSingleObjectTests : WriterSingleObjectTests
{
public DxfWriterSingleObjectTests(ITestOutputHelper output) : base(output) { }

[Theory()]
[MemberData(nameof(Data))]
public void WriteCasesAC1015(SingleCaseGenerator data)
{
this.writeDxfFile(data, ACadVersion.AC1015);
}

[Theory()]
[MemberData(nameof(Data))]
public void WriteCasesAC1018(SingleCaseGenerator data)
Expand Down
2 changes: 1 addition & 1 deletion src/ACadSharp/ACadSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>3.4.1</Version>
<Version>3.4.2</Version>
<PackageOutputPath>../nupkg</PackageOutputPath>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>../ACadSharp.snk</AssemblyOriginatorKeyFile>
Expand Down
45 changes: 42 additions & 3 deletions src/ACadSharp/Classes/DxfClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,47 @@ public class DxfClass
/// If 0, instances may appear only in the OBJECTS section
/// </summary>
[DxfCodeValue(281)]
public bool IsAnEntity { get; set; }
public bool IsAnEntity
{
get => this._isAnEntity;
set
{
if (value)
{
this._itemClassId = 0x1F2;
}
else
{
this._itemClassId = 0x1F3;
}

this._isAnEntity = value;
}
}

/// <summary>
/// Item class id.
/// </summary>
public short ItemClassId { get; internal set; }
/// <remarks>
/// Only effective for dwg.
/// </remarks>
public short ItemClassId
{
get => this._itemClassId;
set
{
if (value == 0x1F2)
{
this._isAnEntity = true;
}
else
{
this._isAnEntity = false;
}

this._itemClassId = value;
}
}

/// <summary>
/// Proxy capabilities flag.
Expand All @@ -66,10 +101,14 @@ public class DxfClass

internal short MaintenanceVersion { get; set; }

private bool _isAnEntity;

private short _itemClassId;

/// <inheritdoc/>
public override string ToString()
{
return $"{DxfName}:{ClassNumber}";
return $"{this.DxfName}:{this.ClassNumber}";
}
}
}
1 change: 0 additions & 1 deletion src/ACadSharp/Classes/DxfClassCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ public static void UpdateDxfClasses(CadDocument doc)
MaintenanceVersion = 0,
ProxyFlags = ProxyFlags.None,
WasZombie = false,
IsAnEntity = false,
});

//AcDbMLeaderObjectContextData
Expand Down
12 changes: 0 additions & 12 deletions src/ACadSharp/IO/DWG/DwgStreamReaders/DwgClassesReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,6 @@ public DxfClassCollection Read()
dxfClass.WasZombie = this._sreader.ReadBit();
//BS : itemclassid -- 0x1F2 for classes which produce entities, 0x1F3 for classes which produce objects.
dxfClass.ItemClassId = this._sreader.ReadBitShort();
if (dxfClass.ItemClassId == 0x1F2)
{
dxfClass.IsAnEntity = true;
}
else if (dxfClass.ItemClassId == 0x1F3)
{
dxfClass.IsAnEntity = false;
}
else
{
this.notify($"Invalid DxfClass id value: {dxfClass.ItemClassId} for {dxfClass.CppClassName}", NotificationType.Warning);
}

if (this.R2004Plus)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ protected override void writeSection()
this._writer.Write(2, c.CppClassName);
this._writer.Write(3, c.ApplicationName);
this._writer.Write(90, (int)c.ProxyFlags);
this._writer.Write(91, c.InstanceCount);

if (this.Version > ACadVersion.AC1015)
{
this._writer.Write(91, c.InstanceCount);
}

this._writer.Write(280, c.WasZombie);
this._writer.Write(281, c.IsAnEntity);
}
Expand Down