Skip to content

Commit

Permalink
Add group proxy (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhankoral authored Jul 17, 2024
1 parent f408980 commit 580521f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
12 changes: 12 additions & 0 deletions src/Speckle.Core/Models/Instances/GroupProxy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Speckle.Core.Models.Instances;

/// <summary>
/// Grouped objects with a meaningful way for host application so use this proxy if you want to group object references for any purpose.
/// i.e. in rhino -> creating group make objects selectable/moveable/editable together.
/// </summary>
public class GroupProxy : Base, IProxyCollection
{
public List<string> objects { get; set; }

public string name { get; set; }
}
2 changes: 1 addition & 1 deletion src/Speckle.Core/Models/Instances/IInstanceComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public interface IInstanceComponent
/// <summary>
/// The maximum "depth" at which this <see cref="InstanceProxy"/> or <see cref="InstanceDefinitionProxy"/> was found. On receive, as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them, starting with definitions first.
/// </summary>
public int MaxDepth { get; set; }
public int maxDepth { get; set; }
}
18 changes: 18 additions & 0 deletions src/Speckle.Core/Models/Instances/IProxyCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Speckle.Core.Models.Instances;

/// <summary>
/// Collection to proxy objects that lies in definitions, groups or whatever logic in the host app.
/// </summary>
public interface IProxyCollection
{
/// <summary>
/// The original ids of the objects that are part of this definition, as present in the source host app.
/// On receive, they will be mapped to corresponding newly created definition ids.
/// </summary>
public List<string> objects { get; set; }

/// <summary>
/// Name of the proxy collection which is unique for rhino, autocad and sketchup
/// </summary>
public string name { get; set; }
}
8 changes: 4 additions & 4 deletions src/Speckle.Core/Models/Instances/InstanceDefinitionProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ namespace Speckle.Core.Models.Instances;
/// <summary>
/// A proxy class for an instance definition.
/// </summary>
public class InstanceDefinitionProxy : Base, IInstanceComponent
public class InstanceDefinitionProxy : Base, IInstanceComponent, IProxyCollection
{
/// <summary>
/// The original ids of the objects that are part of this definition, as present in the source host app. On receive, they will be mapped to corresponding newly created definition ids.
/// </summary>
public List<string> Objects { get; set; } // source app application ids for the objects
public List<string> objects { get; set; } // source app application ids for the objects

public int MaxDepth { get; set; }
public int maxDepth { get; set; }

public string Name { get; set; }
public string name { get; set; }
}
8 changes: 4 additions & 4 deletions src/Speckle.Core/Models/Instances/InstanceProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public class InstanceProxy : Base, IInstanceComponent
/// <summary>
/// The definition id as present in the original host app. On receive, it will be mapped to the newly created definition id.
/// </summary>
public string DefinitionId { get; set; }
public string definitionId { get; set; }

/// <summary>
/// The transform of the instance reference.
/// </summary>
public Matrix4x4 Transform { get; set; }
public Matrix4x4 transform { get; set; }

/// <summary>
/// The units of the host application file.
/// </summary>
public string Units { get; set; } = Kits.Units.Meters;
public string units { get; set; } = Kits.Units.Meters;

public int MaxDepth { get; set; }
public int maxDepth { get; set; }
}

0 comments on commit 580521f

Please sign in to comment.