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
22 changes: 22 additions & 0 deletions src/ACadSharp.Tests/IO/WriterSingleObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static WriterSingleObjectTests()
Data.Add(new(nameof(SingleCaseGenerator.XData)));
Data.Add(new(nameof(SingleCaseGenerator.XRef)));
Data.Add(new(nameof(SingleCaseGenerator.SPlineCreation)));
Data.Add(new(nameof(SingleCaseGenerator.SurfaceEntities)));
Data.Add(new(nameof(SingleCaseGenerator.TextAlignment)));
Data.Add(new(nameof(SingleCaseGenerator.InvalidEntities)));
Data.Add(new(nameof(SingleCaseGenerator.CreateXRecords)));
Expand Down Expand Up @@ -2676,6 +2677,27 @@ public void SPlineCreation()
};
}

public void SurfaceEntities()
{
Line line = new Line(XYZ.Zero, new XYZ(10, 10, 0));
this.Document.Entities.Add(line);

//Surfaces are not written yet, the writers skip them
this.Document.Entities.Add(new Surface());
this.Document.Entities.Add(new ExtrudedSurface());
this.Document.Entities.Add(new LoftedSurface());
this.Document.Entities.Add(new NurbSurface());
this.Document.Entities.Add(new PlaneSurface());
this.Document.Entities.Add(new RevolvedSurface());
this.Document.Entities.Add(new SweptSurface());

this.AssertRoundtrip = (doc) =>
{
Assert.NotNull(doc.GetCadObject<Line>(line.Handle));
Assert.Empty(doc.Entities.OfType<Surface>());
};
}

public void TextAlignment()
{
XYZ insert = new XYZ(0, 0, 0);
Expand Down
12 changes: 12 additions & 0 deletions src/ACadSharp/DxfFileToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public static class DxfFileToken

public const string EntityEllipse = "ELLIPSE";

public const string EntityExtrudedSurface = "EXTRUDEDSURFACE";

public const string EntityHatch = "HATCH";

public const string EntityHelix = "HELIX";
Expand All @@ -82,6 +84,8 @@ public static class DxfFileToken

public const string EntityLine = "LINE";

public const string EntityLoftedSurface = "LOFTEDSURFACE";

public const string EntityLwPolyline = "LWPOLYLINE";

public const string EntityMesh = "MESH";
Expand All @@ -92,12 +96,16 @@ public static class DxfFileToken

public const string EntityMultiLeader = "MULTILEADER";

public const string EntityNurbSurface = "NURBSURFACE";

public const string EntityOle2Frame = "OLE2FRAME";

public const string EntityOleFrame = "OLEFRAME";

public const string EntityPdfUnderlay = "PDFUNDERLAY";

public const string EntityPlaneSurface = "PLANESURFACE";

public const string EntityPoint = "POINT";

public const string EntityPolyFaceMesh = "PFACE";
Expand All @@ -110,6 +118,8 @@ public static class DxfFileToken

public const string EntityRegion = "REGION";

public const string EntityRevolvedSurface = "REVOLVEDSURFACE";

public const string EntitySection = "SECTION";

public const string EntitySeqend = "SEQEND";
Expand All @@ -124,6 +134,8 @@ public static class DxfFileToken

public const string EntitySurface = "SURFACE";

public const string EntitySweptSurface = "SWEPTSURFACE";

public const string EntityTable = "ACAD_TABLE";

public const string EntityText = "TEXT";
Expand Down
14 changes: 14 additions & 0 deletions src/ACadSharp/DxfSubclassMarker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ public static class DxfSubclassMarker

public const string EvalGraphExpr = "AcDbEvalExpr";

public const string ExtrudedSurface = "AcDbExtrudedSurface";

public const string Face3d = "AcDbFace";

public const string Field = "AcDbField";
Expand Down Expand Up @@ -182,6 +184,8 @@ public static class DxfSubclassMarker

public const string LinkedTableData = "AcDbLinkedTableData";

public const string LoftedSurface = "AcDbLoftedSurface";

public const string LwPolyline = "AcDbPolyline";

public const string Material = "AcDbMaterial";
Expand All @@ -206,6 +210,8 @@ public static class DxfSubclassMarker

public const string MultiLeaderObjectContextData = "AcDbMLeaderObjectContextData";

public const string NurbSurface = "AcDbNurbSurface";

public const string ObjectContextData = "AcDbObjectContextData";

public const string Ole2Frame = "AcDbOle2Frame";
Expand All @@ -220,6 +226,8 @@ public static class DxfSubclassMarker

public const string PdfReference = "AcDbPdfReference";

public const string PlaneSurface = "AcDbPlaneSurface";

public const string PlotSettings = "AcDbPlotSettings";

public const string Point = "AcDbPoint";
Expand Down Expand Up @@ -258,6 +266,8 @@ public static class DxfSubclassMarker

public const string Ray = "AcDbRay";

public const string RevolvedSurface = "AcDbRevolvedSurface";

public const string Scale = "AcDbScale";

public const string Shape = "AcDbShape";
Expand All @@ -272,6 +282,10 @@ public static class DxfSubclassMarker

public const string Spline = "AcDbSpline";

public const string Surface = "AcDbSurface";

public const string SweptSurface = "AcDbSweptSurface";

public const string Table = "AcDbSymbolTable";

public const string TableContent = "AcDbTableContent";
Expand Down
37 changes: 37 additions & 0 deletions src/ACadSharp/Entities/ExtrudedSurface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using ACadSharp.Attributes;
using ACadSharp.Classes;

namespace ACadSharp.Entities;

/// <summary>
/// Represents an <see cref="ExtrudedSurface"/> entity.
/// </summary>
/// <remarks>
/// Object name <see cref="DxfFileToken.EntityExtrudedSurface"/> <br/>
/// Dxf class name <see cref="DxfSubclassMarker.ExtrudedSurface"/>
/// </remarks>
[DxfName(DxfFileToken.EntityExtrudedSurface)]
[DxfSubClass(DxfSubclassMarker.ExtrudedSurface)]
public class ExtrudedSurface : Surface
{
/// <inheritdoc/>
public override string ObjectName => DxfFileToken.EntityExtrudedSurface;

/// <inheritdoc/>
public override string SubclassMarker => DxfSubclassMarker.ExtrudedSurface;

/// <inheritdoc/>
public override DxfClass GetDxfClass()
{
return new DxfClass
{
CppClassName = DxfSubclassMarker.ExtrudedSurface,
DwgVersion = (ACadVersion)26,
DxfName = DxfFileToken.EntityExtrudedSurface,
ItemClassId = 498,
MaintenanceVersion = 0,
ProxyFlags = ProxyFlags.None,
WasZombie = false,
};
}
}
37 changes: 37 additions & 0 deletions src/ACadSharp/Entities/LoftedSurface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using ACadSharp.Attributes;
using ACadSharp.Classes;

namespace ACadSharp.Entities;

/// <summary>
/// Represents a <see cref="LoftedSurface"/> entity.
/// </summary>
/// <remarks>
/// Object name <see cref="DxfFileToken.EntityLoftedSurface"/> <br/>
/// Dxf class name <see cref="DxfSubclassMarker.LoftedSurface"/>
/// </remarks>
[DxfName(DxfFileToken.EntityLoftedSurface)]
[DxfSubClass(DxfSubclassMarker.LoftedSurface)]
public class LoftedSurface : Surface
{
/// <inheritdoc/>
public override string ObjectName => DxfFileToken.EntityLoftedSurface;

/// <inheritdoc/>
public override string SubclassMarker => DxfSubclassMarker.LoftedSurface;

/// <inheritdoc/>
public override DxfClass GetDxfClass()
{
return new DxfClass
{
CppClassName = DxfSubclassMarker.LoftedSurface,
DwgVersion = (ACadVersion)26,
DxfName = DxfFileToken.EntityLoftedSurface,
ItemClassId = 498,
MaintenanceVersion = 0,
ProxyFlags = ProxyFlags.None,
WasZombie = false,
};
}
}
37 changes: 37 additions & 0 deletions src/ACadSharp/Entities/NurbSurface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using ACadSharp.Attributes;
using ACadSharp.Classes;

namespace ACadSharp.Entities;

/// <summary>
/// Represents a <see cref="NurbSurface"/> entity.
/// </summary>
/// <remarks>
/// Object name <see cref="DxfFileToken.EntityNurbSurface"/> <br/>
/// Dxf class name <see cref="DxfSubclassMarker.NurbSurface"/>
/// </remarks>
[DxfName(DxfFileToken.EntityNurbSurface)]
[DxfSubClass(DxfSubclassMarker.NurbSurface)]
public class NurbSurface : Surface
{
/// <inheritdoc/>
public override string ObjectName => DxfFileToken.EntityNurbSurface;

/// <inheritdoc/>
public override string SubclassMarker => DxfSubclassMarker.NurbSurface;

/// <inheritdoc/>
public override DxfClass GetDxfClass()
{
return new DxfClass
{
CppClassName = DxfSubclassMarker.NurbSurface,
DwgVersion = (ACadVersion)26,
DxfName = DxfFileToken.EntityNurbSurface,
ItemClassId = 498,
MaintenanceVersion = 0,
ProxyFlags = (ProxyFlags)4095,
WasZombie = false,
};
}
}
37 changes: 37 additions & 0 deletions src/ACadSharp/Entities/PlaneSurface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using ACadSharp.Attributes;
using ACadSharp.Classes;

namespace ACadSharp.Entities;

/// <summary>
/// Represents a <see cref="PlaneSurface"/> entity.
/// </summary>
/// <remarks>
/// Object name <see cref="DxfFileToken.EntityPlaneSurface"/> <br/>
/// Dxf class name <see cref="DxfSubclassMarker.PlaneSurface"/>
/// </remarks>
[DxfName(DxfFileToken.EntityPlaneSurface)]
[DxfSubClass(DxfSubclassMarker.PlaneSurface)]
public class PlaneSurface : Surface
{
/// <inheritdoc/>
public override string ObjectName => DxfFileToken.EntityPlaneSurface;

/// <inheritdoc/>
public override string SubclassMarker => DxfSubclassMarker.PlaneSurface;

/// <inheritdoc/>
public override DxfClass GetDxfClass()
{
return new DxfClass
{
CppClassName = DxfSubclassMarker.PlaneSurface,
DwgVersion = (ACadVersion)26,
DxfName = DxfFileToken.EntityPlaneSurface,
ItemClassId = 498,
MaintenanceVersion = 0,
ProxyFlags = (ProxyFlags)4095,
WasZombie = false,
};
}
}
37 changes: 37 additions & 0 deletions src/ACadSharp/Entities/RevolvedSurface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using ACadSharp.Attributes;
using ACadSharp.Classes;

namespace ACadSharp.Entities;

/// <summary>
/// Represents a <see cref="RevolvedSurface"/> entity.
/// </summary>
/// <remarks>
/// Object name <see cref="DxfFileToken.EntityRevolvedSurface"/> <br/>
/// Dxf class name <see cref="DxfSubclassMarker.RevolvedSurface"/>
/// </remarks>
[DxfName(DxfFileToken.EntityRevolvedSurface)]
[DxfSubClass(DxfSubclassMarker.RevolvedSurface)]
public class RevolvedSurface : Surface
{
/// <inheritdoc/>
public override string ObjectName => DxfFileToken.EntityRevolvedSurface;

/// <inheritdoc/>
public override string SubclassMarker => DxfSubclassMarker.RevolvedSurface;

/// <inheritdoc/>
public override DxfClass GetDxfClass()
{
return new DxfClass
{
CppClassName = DxfSubclassMarker.RevolvedSurface,
DwgVersion = (ACadVersion)26,
DxfName = DxfFileToken.EntityRevolvedSurface,
ItemClassId = 498,
MaintenanceVersion = 0,
ProxyFlags = ProxyFlags.None,
WasZombie = false,
};
}
}
52 changes: 52 additions & 0 deletions src/ACadSharp/Entities/Surface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using ACadSharp.Attributes;
using ACadSharp.Classes;

namespace ACadSharp.Entities;

/// <summary>
/// Represents a <see cref="Surface"/> entity.
/// </summary>
/// <remarks>
/// Object name <see cref="DxfFileToken.EntitySurface"/> <br/>
/// Dxf class name <see cref="DxfSubclassMarker.Surface"/>
/// </remarks>
[DxfName(DxfFileToken.EntitySurface)]
[DxfSubClass(DxfSubclassMarker.Surface)]
public class Surface : ModelerGeometry, IDxfClassDefined
{
Comment thread
DomCR marked this conversation as resolved.
/// <inheritdoc/>
public override ObjectType ObjectType => ObjectType.UNLISTED;

/// <inheritdoc/>
public override string ObjectName => DxfFileToken.EntitySurface;

/// <inheritdoc/>
public override string SubclassMarker => DxfSubclassMarker.Surface;

/// <summary>
/// Number of U isolines.
/// </summary>
[DxfCodeValue(71)]
public short UIsolines { get; set; }

/// <summary>
/// Number of V isolines.
/// </summary>
[DxfCodeValue(72)]
public short VIsolines { get; set; }

/// <inheritdoc/>
public virtual DxfClass GetDxfClass()
{
return new DxfClass
{
CppClassName = DxfSubclassMarker.Surface,
DwgVersion = (ACadVersion)26,
DxfName = DxfFileToken.EntitySurface,
ItemClassId = 498,
MaintenanceVersion = 0,
ProxyFlags = (ProxyFlags)4095,
WasZombie = false,
};
}
}
Loading
Loading