- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to report an issue concerning the behavior of Generic Model Adaptive FamilyInstances.
Specifically, they are not captured by .GetAddedElementIds() in combination with .GetChangeTypeElementAddition() or even outside of it.
The only elements recorded are ReferencePoints, and even then, the last placement point is omitted after the placement is finalized. With Adaptive family with no Placement Points - it records nothing. It's worth noting that the recorded points are temporary and get deleted once placement is complete. Furthermore, the only instance where new IDs are registered is through .GetModifiedElementIds(), but this occurs outside of .GetChangeTypeElementAddition(). And using .GetModifiedElementIds() as a workaround introduces too much of overhead for my intended purposes.
To my knowledge, this behavior is unique to Adaptive type of Generic Model Family.
To illustrate this issue, I've prepared a minimal Visual Studio solution along with a compiled .bundle. This setup interactively demonstrates the problem, confirming that it does not affect other Revit Elements (although further testing with additional elements has not yet been conducted). I have also included a small .rvt project with some families for testing. Given the interactive WPF components, creating a macro to handle this proved challenging, so I have provided a video demonstration instead.
Most of the code in the solution is just for the sake of intractability and logging. BackgroundApp.cs is where the aforementioned issues occur.
public void UpdaterSetup(Document doc)
{
Dialog.Instance.Show();
if (!updaterRegistered)
{
AddInId appId = doc.Application.ActiveAddInId;
Guid updaterGuid = new Guid("E411B264-AF90-4E58-BEFA-29734BC7DEB8");
MyElementAdditionUpdater updater = new MyElementAdditionUpdater(appId, updaterGuid);
UpdaterRegistry.RegisterUpdater(updater);
//AREA OF INTEREST
//AREA OF INTEREST
//AREA OF INTEREST
UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), new ElementIsElementTypeFilter(true), Element.GetChangeTypeElementAddition());
//AREA OF INTEREST
//AREA OF INTEREST
//AREA OF INTEREST
// Update the flag to indicate the updater is registered
updaterRegistered = true;
Debug.Print("Updater has been registered.");
handler = new HighlightElementEventHandler();
ExEvent = ExternalEvent.Create(handler);
}
}
public class MyElementAdditionUpdater : IUpdater
{
private readonly UpdaterId _updaterId;
public MyElementAdditionUpdater(AddInId addInId, Guid updaterGuid)
{
_updaterId = new UpdaterId(addInId, updaterGuid);
}
public void Execute(UpdaterData data)
{
Document doc = data.GetDocument();
//AREA OF INTEREST
//AREA OF INTEREST
//AREA OF INTEREST
foreach (ElementId addedElementId in data.GetAddedElementIds())
//AREA OF INTEREST
//AREA OF INTEREST
//AREA OF INTEREST
{
Element addedElement = doc.GetElement(addedElementId);
var elemInfo = new ElementInfo
{
ElementId = addedElementId.Value.ToString(),
ElementType = addedElement.GetType().Name
};
// Add directly using the dialog's public method
Dialog.Instance.AddElementInfo(elemInfo);
Debug.Print($"Added Element ID: {addedElementId}, Type: {addedElement.GetType().Name}");
}
}
public string GetAdditionalInformation() => "Handles addition of new elements";
public ChangePriority GetChangePriority() => ChangePriority.FreeStandingComponents;
public UpdaterId GetUpdaterId() => _updaterId;
public string GetUpdaterName() => "Custom Element Addition Updater";
}
I would appreciate some guidance on how to submit this issue to the development team, as I can't imagine this being the intended result. I've been unable to find a way to do so with my trial ADN account. Unless I'm able to create the case through normal means, should I direct this to Technical Product Support instead?
Thanks.
Solved! Go to Solution.