diff --git a/src/ACadSharp/Entities/UnknownEntity.cs b/src/ACadSharp/Entities/UnknownEntity.cs
index 65022e73..b078ba8b 100644
--- a/src/ACadSharp/Entities/UnknownEntity.cs
+++ b/src/ACadSharp/Entities/UnknownEntity.cs
@@ -4,10 +4,10 @@
namespace ACadSharp.Entities
{
///
- /// Class that holds the basic information for an unknown entity
+ /// Class that holds the basic information for an unknown .
///
///
- /// Unknown entities may appear in the if the dwg file contains proxies or entities not yet supported by ACadSharp
+ /// Unknown entities may appear in the if the cad file contains proxies or entities not yet supported by ACadSharp.
///
public class UnknownEntity : Entity
{
@@ -47,7 +47,7 @@ public override string SubclassMarker
}
///
- /// Dxf class linked to this entity
+ /// Dxf class linked to this entity.
///
public DxfClass DxfClass { get; }
@@ -62,7 +62,7 @@ internal UnknownEntity(DxfClass dxfClass)
///
public override BoundingBox GetBoundingBox()
{
- return default;
+ return BoundingBox.Null;
}
}
}
diff --git a/src/ACadSharp/IO/DWG/DwgDocumentBuilder.cs b/src/ACadSharp/IO/DWG/DwgDocumentBuilder.cs
index 18efe1a7..f8a6076d 100644
--- a/src/ACadSharp/IO/DWG/DwgDocumentBuilder.cs
+++ b/src/ACadSharp/IO/DWG/DwgDocumentBuilder.cs
@@ -1,5 +1,6 @@
using ACadSharp.Entities;
using ACadSharp.IO.Templates;
+using ACadSharp.Objects;
using System.Collections.Generic;
namespace ACadSharp.IO.DWG
@@ -14,6 +15,8 @@ internal class DwgDocumentBuilder : CadDocumentBuilder
public List UnknownEntities { get; } = new();
+ public List UnknownNonGraphicalObjects { get; } = new();
+
public List PaperSpaceEntities { get; } = new();
public List ModelSpaceEntities { get; } = new();
diff --git a/src/ACadSharp/IO/DWG/DwgStreamReaders/DwgObjectReader.cs b/src/ACadSharp/IO/DWG/DwgStreamReaders/DwgObjectReader.cs
index 7f8b5966..730bf645 100644
--- a/src/ACadSharp/IO/DWG/DwgStreamReaders/DwgObjectReader.cs
+++ b/src/ACadSharp/IO/DWG/DwgStreamReaders/DwgObjectReader.cs
@@ -996,8 +996,6 @@ private CadTemplate readUnlistedType(short classNumber)
case "LWPOLYLINE":
template = this.readLWPolyline();
break;
- case "MATERIAL":
- break;
case "MESH":
template = this.readMesh();
break;
@@ -1019,9 +1017,9 @@ private CadTemplate readUnlistedType(short classNumber)
case "SORTENTSTABLE":
template = this.readSortentsTable();
break;
- case "VISUALSTYLE":
- template = this.readVisualStyle();
- break;
+ //case "VISUALSTYLE":
+ // template = this.readVisualStyle();
+ // break;
case "WIPEOUT":
template = this.readCadImage(new Wipeout());
break;
@@ -1037,6 +1035,11 @@ private CadTemplate readUnlistedType(short classNumber)
template = this.readUnknownEntity(c);
this._builder.Notify($"Unlisted object with DXF name {c.DxfName} has been read as an UnknownEntity", NotificationType.Warning);
}
+ else if (template == null && !c.IsAnEntity)
+ {
+ template = this.readUnknownNonGraphicalObject(c);
+ this._builder.Notify($"Unlisted object with DXF name {c.DxfName} has been read as an UnknownNonGraphicalObject", NotificationType.Warning);
+ }
if (template == null)
{
@@ -1060,6 +1063,18 @@ private CadTemplate readUnknownEntity(DxfClass dxfClass)
return template;
}
+ private CadTemplate readUnknownNonGraphicalObject(DxfClass dxfClass)
+ {
+ UnknownNonGraphicalObject obj = new UnknownNonGraphicalObject(dxfClass);
+ CadUnknownNonGraphicalObjectTemplate template = new CadUnknownNonGraphicalObjectTemplate(obj);
+
+ this._builder.UnknownNonGraphicalObjects.Add(obj);
+
+ this.readCommonNonEntityData(template);
+
+ return template;
+ }
+
private CadTemplate readText()
{
TextEntity text = new TextEntity();
diff --git a/src/ACadSharp/IO/Templates/CadUnknownEntityTemplate.cs b/src/ACadSharp/IO/Templates/CadUnknownEntityTemplate.cs
index d38631ed..73971e08 100644
--- a/src/ACadSharp/IO/Templates/CadUnknownEntityTemplate.cs
+++ b/src/ACadSharp/IO/Templates/CadUnknownEntityTemplate.cs
@@ -1,7 +1,13 @@
using ACadSharp.Entities;
+using ACadSharp.Objects;
namespace ACadSharp.IO.Templates
{
+ internal class CadUnknownNonGraphicalObjectTemplate : CadNonGraphicalObjectTemplate
+ {
+ public CadUnknownNonGraphicalObjectTemplate(UnknownNonGraphicalObject obj) : base(obj) { }
+ }
+
internal class CadUnknownEntityTemplate : CadEntityTemplate
{
public CadUnknownEntityTemplate(UnknownEntity entity) : base(entity) { }
diff --git a/src/ACadSharp/Objects/UnknownNonGraphicalObject.cs b/src/ACadSharp/Objects/UnknownNonGraphicalObject.cs
new file mode 100644
index 00000000..fcf3b25f
--- /dev/null
+++ b/src/ACadSharp/Objects/UnknownNonGraphicalObject.cs
@@ -0,0 +1,58 @@
+using ACadSharp.Classes;
+
+namespace ACadSharp.Objects
+{
+ ///
+ /// Class that holds the basic information for an unknown .
+ ///
+ ///
+ /// Unknown entities may appear in the if the cad file contains proxies or objects not yet supported by ACadSharp.
+ ///
+ public class UnknownNonGraphicalObject : NonGraphicalObject
+ {
+ ///
+ public override ObjectType ObjectType => ObjectType.UNDEFINED;
+
+ ///
+ public override string ObjectName
+ {
+ get
+ {
+ if (this.DxfClass == null)
+ {
+ return "UNKNOWN";
+ }
+ else
+ {
+ return this.DxfClass.DxfName;
+ }
+ }
+ }
+
+ ///
+ public override string SubclassMarker
+ {
+ get
+ {
+ if (this.DxfClass == null)
+ {
+ return DxfSubclassMarker.Entity;
+ }
+ else
+ {
+ return this.DxfClass.CppClassName;
+ }
+ }
+ }
+
+ ///
+ /// Dxf class linked to this entity.
+ ///
+ public DxfClass DxfClass { get; }
+
+ internal UnknownNonGraphicalObject(DxfClass dxfClass)
+ {
+ this.DxfClass = dxfClass;
+ }
+ }
+}