Skip to content

Commit

Permalink
revert but keep todo
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbradleym committed Jan 3, 2025
1 parent 2897b96 commit 8355394
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
21 changes: 3 additions & 18 deletions Elements.MEP/src/Fittings/FittingRepresentationStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,17 @@ static class FittingRepresentationStorage
private static readonly Dictionary<string, List<RepresentationInstance>> _fittings = new Dictionary<string, List<RepresentationInstance>>();
public static Dictionary<string, List<RepresentationInstance>> Fittings => _fittings;

public static void SetFittingRepresentation(Fitting fitting, Func<IList<SolidOperation>> makeSolids, Boolean unioned = true, Boolean updateTransform = true)
public static void SetFittingRepresentation(Fitting fitting, Func<IList<SolidOperation>> makeSolids)
{
var hash = fitting.GetRepresentationHash();
if (!_fittings.ContainsKey(hash))
{
var solids = makeSolids();
var representationInstances = new List<RepresentationInstance>();
if (unioned)
{
representationInstances = new List<RepresentationInstance> { new RepresentationInstance(new SolidRepresentation(solids), fitting.Material) };
}
else
{
foreach (var solid in solids)
{
representationInstances.Add(new RepresentationInstance(new SolidRepresentation(solid), fitting.Material));
}
}
_fittings.Add(hash, representationInstances);
_fittings.Add(hash, new List<RepresentationInstance> { new RepresentationInstance(new SolidRepresentation(solids), fitting.Material) });
}
fitting.RepresentationInstances = _fittings[hash];

if (updateTransform)
{
fitting.Transform = fitting.GetRotatedTransform().Concatenated(new Transform(fitting.Transform.Origin));
}
fitting.Transform = fitting.GetRotatedTransform().Concatenated(new Transform(fitting.Transform.Origin));
}
}
}
5 changes: 4 additions & 1 deletion Elements.MEP/src/Fittings/Reducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ public override void UpdateRepresentations()
// It would also be ideal to fully understand the geometry artifacts seen with certain Reducers that result in
// bad boolean graphics which result in invisible or fractured geometry.
var solidOperations = new List<SolidOperation> { sweep1, sweep2 }.Concat(arrows).ToList();
FittingRepresentationStorage.SetFittingRepresentation(this, () => solidOperations, false, false);
foreach (var solidOperation in solidOperations)
{
this.RepresentationInstances.Add(new RepresentationInstance(new SolidRepresentation(solidOperation), this.Material));
}
}

public override void ApplyAdditionalTransform()
Expand Down

0 comments on commit 8355394

Please sign in to comment.