d76865e621
* First pass of moving IFC to connectors repo * Fix some errors and ignore others * fix namespaces and exceptions * fix namespaces * formatting * Fix namespaces and move stuff * add linux ci * more csproj changes * importer stuff will be the nuget * add pack version and to Local sln * do a nuget push on main * fix restore
53 lines
1.1 KiB
C#
53 lines
1.1 KiB
C#
using Ara3D.Utils;
|
|
|
|
namespace Speckle.Importers.Ifc.Ara3D.StepParser;
|
|
|
|
public class StepNode
|
|
{
|
|
public readonly StepGraph Graph;
|
|
public readonly StepInstance Entity;
|
|
|
|
public StepNode(StepGraph g, StepInstance e)
|
|
{
|
|
Graph = g;
|
|
Entity = e;
|
|
}
|
|
|
|
public List<StepNode> Nodes { get; } = new();
|
|
|
|
private void AddNodes(StepValue value)
|
|
{
|
|
if (value is StepId id)
|
|
{
|
|
var n = Graph.GetNode(id.Id);
|
|
Nodes.Add(n);
|
|
}
|
|
else if (value is StepList agg)
|
|
{
|
|
foreach (var v in agg.Values)
|
|
AddNodes(v);
|
|
}
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
foreach (var a in Entity.AttributeValues)
|
|
AddNodes(a);
|
|
}
|
|
|
|
public override string ToString() => Entity.ToString();
|
|
|
|
public string ToGraph(HashSet<StepNode>? prev = null)
|
|
{
|
|
prev ??= new HashSet<StepNode>();
|
|
if (prev.Contains(this))
|
|
return "_";
|
|
var nodeStr = Nodes.Select(n => n.ToGraph(prev)).JoinStringsWithComma();
|
|
return $"{EntityType}({nodeStr})";
|
|
}
|
|
|
|
public string EntityType => Entity.EntityType;
|
|
|
|
public string QuickHash() => $"{EntityType}:{Nodes.Count}";
|
|
}
|