Skip to content

Commit

Permalink
Merge branch 'dev' into ui-host-app-test-binding
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Jan 10, 2025
2 parents 75865f9 + c5d37a1 commit 571d2b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ internal sealed class Connector : NAV.Plugins.DockPanePlugin

public override Control CreateControlPane()
{
AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver.OnAssemblyResolve<Connector>;

var services = new ServiceCollection();

services.Initialize(HostApplications.Navisworks, HostAppVersion.v2024);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public IEnumerable<Element> UnpackSelectionForConversion(IEnumerable<Element> se
// Step 2: pack curtain wall elements, once we know the full extent of our flattened item list.
// The behaviour we're looking for:
// If parent wall is part of selection, does not select individual elements out. Otherwise, selects individual elements (Panels, Mullions) as atomic objects.
return PackCurtainWallElements(atomicObjects);
// NOTE: this also conditionally "packs" stacked wall elements if their parent is present. See detailed note inside the function.
return PackCurtainWallElementsAndStackedWalls(atomicObjects);
}

/// <summary>
Expand Down Expand Up @@ -90,7 +91,7 @@ private List<Element> UnpackElements(IEnumerable<Element> elements)
return unpackedElements.GroupBy(el => el.Id).Select(g => g.First()).ToList(); // no disinctBy in here sadly.
}

private List<Element> PackCurtainWallElements(List<Element> elements)
private List<Element> PackCurtainWallElementsAndStackedWalls(List<Element> elements)
{
var ids = elements.Select(el => el.Id).ToArray();
var doc = _revitContext.UIApplication?.ActiveUIDocument.Document!;
Expand All @@ -102,6 +103,12 @@ private List<Element> PackCurtainWallElements(List<Element> elements)
&& doc.GetElement(f.Host.Id) is Wall { CurtainGrid: not null }
&& ids.Contains(f.Host.Id)
)
// NOTE: It is required to explicitly skip stacked wall members because, when getting objects from a view,
// the api will return the wall parent and its stacked children walls separately. This does not happen
// via selection. Via category ("Walls") we do not get any parent wall, but just the components of the stacked wall separately.
// If you wonder why revit is driving people to insanity, this is one of those moments.
// See [CNX-851: Stacked Wall Duplicate Geometry or Materials not applied](https://linear.app/speckle/issue/CNX-851/stacked-wall-duplicate-geometry-or-materials-not-applied)
|| (element is Wall { IsStackedWallMember: true } wall && ids.Contains(wall.StackedWallOwnerId))
);
return elements;
}
Expand Down

0 comments on commit 571d2b7

Please sign in to comment.