Skip to content

Commit

Permalink
Adds new classes for raw encoded objects (Brep, Extrusion and Subd) (#…
Browse files Browse the repository at this point in the history
…139)

* feat: adds wip classes for brep/subd/extrusion-x

* Get rid of dub code on ExtrusionX SubDX BrepX

* fix: Run format

* chore: formatting

* chore: more formatting

help dis annoying

---------

Co-authored-by: oguzhankoral <[email protected]>
Co-authored-by: Alan Rynne <[email protected]>
Co-authored-by: Adam Hathcock <[email protected]>
  • Loading branch information
4 people authored Oct 10, 2024
1 parent 1a9d28e commit 1241589
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/Speckle.Objects/Geometry/BrepX.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Speckle.Objects.Other;
using Speckle.Sdk.Models;

namespace Speckle.Objects.Geometry;

public interface IRawEncodedObject
{
public RawEncoding encodedValue { get; set; }
}

public abstract class RawEncodedObject : Base, IDisplayValue<List<Mesh>>, IRawEncodedObject, IHasArea, IHasVolume
{
[DetachProperty]
public required List<Mesh> displayValue { get; set; }

[DetachProperty]
public required RawEncoding encodedValue { get; set; }

public required string units { get; set; }

public double area { get; set; }

public double volume { get; set; }
}

[SpeckleType("Objects.Geometry.BrepX")]
public class BrepX : RawEncodedObject;

[SpeckleType("Objects.Geometry.ExtrusionX")]
public class ExtrusionX : RawEncodedObject;

[SpeckleType("Objects.Geometry.SubDX")]
public class SubDX : RawEncodedObject;
23 changes: 23 additions & 0 deletions src/Speckle.Objects/Other/RawEncoding.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Speckle.Sdk.Models;

namespace Speckle.Objects.Other;

/// <summary>
/// Keeps track of a raw-encoded object in a native supported format. see <see cref="RawEncodingFormats"/>
/// </summary>
[SpeckleType("Objects.Other.RawEncoding")]
public class RawEncoding : Base // note: at this stage, since we're using this for extrusions and subds the name doesn't make sense anymore
{
public required string format { get; set; }
public required string contents { get; set; }

public RawEncoding() { }
}

/// <summary>
/// Supported encoding types "strongly" typed strings. This needs to match the extension of the file format.
/// </summary>
public static class RawEncodingFormats
{
public const string RHINO_3DM = "3dm";
}

0 comments on commit 1241589

Please sign in to comment.